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

Merge branch 'add-debug-mode' into v3.3.0

parents 89057fc3 c571fd7b
No related branches found
No related tags found
No related merge requests found
Pipeline #28929 passed
import { Command } from 'commander';
import { Command, Option } from 'commander';
import SessionCommand from './session/SessionCommand';
import ClientsSharedConfig from '../sharedByClients/config/ClientsSharedConfig';
import AssignmentCommand from './assignment/AssignmentCommand';
......@@ -26,6 +26,7 @@ class CommanderApp {
sortSubcommands : true
})
.option('-H, --host <string>', 'override the Dojo API endpoint', ClientsSharedConfig.apiURL)
.addOption(new Option('--debug').hideHelp())
.hook('preAction', () => {
this.warnDevelopmentVersion();
}).hook('postAction', () => {
......@@ -36,6 +37,10 @@ class CommanderApp {
ClientsSharedConfig.apiURL = this.program.opts().host;
});
this.program.on('option:debug', () => {
SharedConfig.debug = true;
});
this.registerCommands();
this.program.parse();
......
......@@ -5,6 +5,7 @@ import chalk from 'chalk';
import AssignmentValidator from '../../../sharedByClients/helpers/Dojo/AssignmentValidator';
import ClientsSharedAssignmentHelper from '../../../sharedByClients/helpers/Dojo/ClientsSharedAssignmentHelper';
import { Option } from 'commander';
import SharedConfig from '../../../shared/config/SharedConfig';
class AssignmentCheckCommand extends CommanderCommand {
......@@ -21,7 +22,7 @@ class AssignmentCheckCommand extends CommanderCommand {
}
protected async commandAction(options: { path: string, verbose: boolean, superVerbose: boolean }): Promise<void> {
const verbose: boolean = options.verbose || options.superVerbose;
const verbose: boolean = options.verbose || options.superVerbose || SharedConfig.debug;
const localExercisePath: string = options.path ?? Config.folders.defaultLocalExercise;
......@@ -43,7 +44,7 @@ class AssignmentCheckCommand extends CommanderCommand {
buildPhase = false;
}
if ( displayable && (options.superVerbose || buildPhase === false) ) {
if ( SharedConfig.debug || (displayable && (options.superVerbose || buildPhase === false)) ) {
console.log(line);
}
}
......
......@@ -13,6 +13,7 @@ import ClientsSharedExerciseHelper from '../../sharedByClients/helpers/
import os from 'os';
import util from 'util';
import { exec } from 'child_process';
import SharedConfig from '../../shared/config/SharedConfig';
const execAsync = util.promisify(exec);
......@@ -37,7 +38,7 @@ class ExerciseRunHelper {
}
async run(options: { path: string, verbose: boolean, superVerbose: boolean }): Promise<void> {
const verbose: boolean = options.verbose || options.superVerbose;
const verbose: boolean = options.verbose || options.superVerbose || SharedConfig.debug;
const localExercisePath: string = options.path ?? Config.folders.defaultLocalExercise;
......@@ -150,7 +151,7 @@ class ExerciseRunHelper {
buildPhase = false;
}
if ( displayable && (options.superVerbose || buildPhase === false) ) {
if ( SharedConfig.debug || (displayable && (options.superVerbose || buildPhase === false)) ) {
console.log(line);
}
}
......
Subproject commit 36004dfe8f24a27e4896620118598f9e74df3677
Subproject commit f370f8b0a6e7b059d12f1980cdd21e3f2daa2f04
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment