diff --git a/NodeApp/src/commander/assignment/subcommands/AssignmentRunCommand.ts b/NodeApp/src/commander/assignment/subcommands/AssignmentRunCommand.ts index e33c755cf8416eec60414a582e68bcc436899fd7..9a7489f2e9db1792682554f343ebc0b1b62fa2ee 100644 --- a/NodeApp/src/commander/assignment/subcommands/AssignmentRunCommand.ts +++ b/NodeApp/src/commander/assignment/subcommands/AssignmentRunCommand.ts @@ -1,5 +1,6 @@ import CommanderCommand from '../../CommanderCommand'; import Config from '../../../config/Config'; +import { Option } from 'commander'; import ExerciseRunHelper from '../../../helpers/Dojo/ExerciseRunHelper'; @@ -11,11 +12,13 @@ class AssignmentRunCommand extends CommanderCommand { this.command .description('locally run the assignment as an exercise') .option('-p, --path <value>', 'exercise path', Config.folders.defaultLocalExercise) - .option('-v, --verbose', 'verbose mode (display docker compose logs in live)') + .option('-v, --verbose', 'verbose mode - display principal container output in live') + .addOption(new Option('-w, --super-verbose', 'verbose mode - display all docker compose logs (build included) in live').conflicts('verbose')) + .addOption(new Option('--verbose-ssj2').hideHelp().implies({ superVerbose: true })) .action(this.commandAction.bind(this)); } - protected async commandAction(options: { path: string, verbose: boolean }): Promise<void> { + protected async commandAction(options: { path: string, verbose: boolean, superVerbose: boolean }): Promise<void> { await ExerciseRunHelper.run(options); } } diff --git a/NodeApp/src/commander/exercise/subcommands/ExerciseRunCommand.ts b/NodeApp/src/commander/exercise/subcommands/ExerciseRunCommand.ts index 90282b7955b1dccfdb20925e4f20fd8b3337c9a4..c4d6b2195d767955bafb319875993b8733e77176 100644 --- a/NodeApp/src/commander/exercise/subcommands/ExerciseRunCommand.ts +++ b/NodeApp/src/commander/exercise/subcommands/ExerciseRunCommand.ts @@ -1,6 +1,7 @@ import CommanderCommand from '../../CommanderCommand'; import Config from '../../../config/Config'; import ExerciseRunHelper from '../../../helpers/Dojo/ExerciseRunHelper'; +import { Option } from 'commander'; class ExerciseRunCommand extends CommanderCommand { @@ -11,11 +12,13 @@ class ExerciseRunCommand extends CommanderCommand { this.command .description('locally run an exercise') .option('-p, --path <value>', 'exercise path', Config.folders.defaultLocalExercise) - .option('-v, --verbose', 'verbose mode (display docker compose logs in live)') + .option('-v, --verbose', 'verbose mode - display principal container output in live') + .addOption(new Option('-w, --super-verbose', 'verbose mode - display all docker compose logs (build included) in live').conflicts('verbose')) + .addOption(new Option('--verbose-ssj2').hideHelp().implies({ superVerbose: true })) .action(this.commandAction.bind(this)); } - protected async commandAction(options: { path: string, verbose: boolean }): Promise<void> { + protected async commandAction(options: { path: string, verbose: boolean, superVerbose: boolean }): Promise<void> { await ExerciseRunHelper.run(options); } } diff --git a/NodeApp/src/helpers/Dojo/ExerciseRunHelper.ts b/NodeApp/src/helpers/Dojo/ExerciseRunHelper.ts index 27113aaa7944e18ce4fec161fe0a3a8799466eb9..49635d05277fa059e87920dade7d613b6b7c9186 100644 --- a/NodeApp/src/helpers/Dojo/ExerciseRunHelper.ts +++ b/NodeApp/src/helpers/Dojo/ExerciseRunHelper.ts @@ -36,7 +36,9 @@ class ExerciseRunHelper { }).start().info(); } - async run(options: { path: string, verbose: boolean }): Promise<void> { + async run(options: { path: string, verbose: boolean, superVerbose: boolean }): Promise<void> { + const verbose: boolean = options.verbose || options.superVerbose; + const localExercisePath: string = options.path ?? Config.folders.defaultLocalExercise; let assignmentFile: AssignmentFile; @@ -136,10 +138,17 @@ class ExerciseRunHelper { await new Promise<void>((resolve, reject) => { let spinner: ora.Ora; - if ( options.verbose ) { - exerciseDockerCompose.events.on('logs', (log: string, _error: boolean, displayable: boolean) => { - if ( displayable ) { - console.log(log); + if ( verbose ) { + let buildPhase: boolean = true; + exerciseDockerCompose.events.on('logs', (log: string, _error: boolean, displayable: boolean, currentStep: string) => { + for ( const line of log.split('\n') ) { + if ( currentStep == 'COMPOSE_RUN' && buildPhase && line != '' && !line.startsWith('#') ) { + buildPhase = false; + } + + if ( displayable && (options.superVerbose || !buildPhase) ) { + console.log(line); + } } }); } @@ -150,14 +159,14 @@ class ExerciseRunHelper { indent: 4 }).start(); - if ( options.verbose && name == 'COMPOSE_RUN' ) { + if ( verbose && name == 'COMPOSE_RUN' ) { spinner.info(); } }); exerciseDockerCompose.events.on('endStep', (stepName: string, message: string, error: boolean) => { if ( error ) { - if ( options.verbose && stepName == 'COMPOSE_RUN' ) { + if ( verbose && stepName == 'COMPOSE_RUN' ) { ora({ text : message, indent: 4 @@ -166,7 +175,7 @@ class ExerciseRunHelper { spinner.fail(message); } } else { - if ( options.verbose && stepName == 'COMPOSE_RUN' ) { + if ( verbose && stepName == 'COMPOSE_RUN' ) { ora({ text : message, indent: 4 diff --git a/NodeApp/src/sharedByClients b/NodeApp/src/sharedByClients index 06f4fcdc53a384d6a9c85e68b7debf10dfbe25a8..e8114e0562f00fc95144ec451dc8365f8cc8f22c 160000 --- a/NodeApp/src/sharedByClients +++ b/NodeApp/src/sharedByClients @@ -1 +1 @@ -Subproject commit 06f4fcdc53a384d6a9c85e68b7debf10dfbe25a8 +Subproject commit e8114e0562f00fc95144ec451dc8365f8cc8f22c