Skip to content
Snippets Groups Projects
Commit 706ea013 authored by michael.minelli's avatar michael.minelli
Browse files

Commander => Add interactive mode

parent 5be5840e
No related branches found
No related tags found
No related merge requests found
...@@ -26,6 +26,7 @@ class CommanderApp { ...@@ -26,6 +26,7 @@ class CommanderApp {
sortSubcommands : true sortSubcommands : true
}) })
.option('-H, --host <string>', 'override the Dojo API endpoint', ClientsSharedConfig.apiURL) .option('-H, --host <string>', 'override the Dojo API endpoint', ClientsSharedConfig.apiURL)
.option('-I, --interactive', 'show interactive interface when available', Config.interactiveMode)
.addOption(new Option('--debug').hideHelp()) .addOption(new Option('--debug').hideHelp())
.hook('preAction', () => { .hook('preAction', () => {
this.warnDevelopmentVersion(); this.warnDevelopmentVersion();
...@@ -37,6 +38,10 @@ class CommanderApp { ...@@ -37,6 +38,10 @@ class CommanderApp {
ClientsSharedConfig.apiURL = this.program.opts().host; ClientsSharedConfig.apiURL = this.program.opts().host;
}); });
this.program.on('option:interactive', () => {
Config.interactiveMode = this.program.opts().interactive;
});
this.program.on('option:debug', () => { this.program.on('option:debug', () => {
SharedConfig.debug = true; SharedConfig.debug = true;
}); });
......
...@@ -30,6 +30,8 @@ class Config { ...@@ -30,6 +30,8 @@ class Config {
neededFiles: Array<string> neededFiles: Array<string>
}; };
public interactiveMode: boolean;
constructor() { constructor() {
this.localConfig = { this.localConfig = {
folder : getAppDataPath('DojoCLI'), folder : getAppDataPath('DojoCLI'),
...@@ -62,6 +64,8 @@ class Config { ...@@ -62,6 +64,8 @@ class Config {
this.exercise = { this.exercise = {
neededFiles: JSON.parse(process.env.EXERCISE_NEEDED_FILES || '[]') neededFiles: JSON.parse(process.env.EXERCISE_NEEDED_FILES || '[]')
}; };
this.interactiveMode = process.env.INTERACTIVE_MODE === 'true';
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment