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

ExerciseRun => Add verbose mode (display compose output in live)

parent 52a6dd06
No related branches found
No related tags found
No related merge requests found
Pipeline #26551 passed
...@@ -36,6 +36,7 @@ class ExerciseRunCommand extends CommanderCommand { ...@@ -36,6 +36,7 @@ class ExerciseRunCommand extends CommanderCommand {
this.command this.command
.description('locally run an exercise') .description('locally run an exercise')
.option('-p, --path <value>', 'exercise path', Config.folders.defaultLocalExercise) .option('-p, --path <value>', 'exercise path', Config.folders.defaultLocalExercise)
.option('-v, --verbose', 'exercise path', Config.folders.defaultLocalExercise)
.action(this.commandAction.bind(this)); .action(this.commandAction.bind(this));
} }
...@@ -46,7 +47,7 @@ class ExerciseRunCommand extends CommanderCommand { ...@@ -46,7 +47,7 @@ class ExerciseRunCommand extends CommanderCommand {
}).start().info(); }).start().info();
} }
protected async commandAction(options: any): Promise<void> { protected async commandAction(options: { path: string, verbose: boolean }): Promise<void> {
const localExercisePath = options.path ?? Config.folders.defaultLocalExercise; const localExercisePath = options.path ?? Config.folders.defaultLocalExercise;
let assignmentFile: AssignmentFile; let assignmentFile: AssignmentFile;
...@@ -138,6 +139,14 @@ class ExerciseRunCommand extends CommanderCommand { ...@@ -138,6 +139,14 @@ class ExerciseRunCommand extends CommanderCommand {
await new Promise<void>((resolve, reject) => { await new Promise<void>((resolve, reject) => {
let spinner: ora.Ora; let spinner: ora.Ora;
if ( options.verbose ) {
exerciseDockerCompose.events.on('logs', (log: string, _error: boolean, displayable: boolean) => {
if ( displayable ) {
console.log(log);
}
});
}
exerciseDockerCompose.events.on('step', (name: string, message: string) => { exerciseDockerCompose.events.on('step', (name: string, message: string) => {
spinner = ora({ spinner = ora({
text : message, text : message,
......
...@@ -15,7 +15,7 @@ class SessionAppLoginCommand extends CommanderCommand { ...@@ -15,7 +15,7 @@ class SessionAppLoginCommand extends CommanderCommand {
.action(this.commandAction.bind(this)); .action(this.commandAction.bind(this));
} }
protected async commandAction(options: any): Promise<void> { protected async commandAction(options: { user: string, password: string }): Promise<void> {
if ( !options.password ) { if ( !options.password ) {
options.password = (await inquirer.prompt({ options.password = (await inquirer.prompt({
type : 'password', type : 'password',
......
...@@ -14,7 +14,7 @@ class SessionGitlabLoginCommand extends CommanderCommand { ...@@ -14,7 +14,7 @@ class SessionGitlabLoginCommand extends CommanderCommand {
.action(this.commandAction.bind(this)); .action(this.commandAction.bind(this));
} }
protected async commandAction(options: any): Promise<void> { protected async commandAction(options: { token: string }): Promise<void> {
if ( !options.token ) { if ( !options.token ) {
options.token = (await inquirer.prompt({ options.token = (await inquirer.prompt({
type : 'password', type : 'password',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment