From 5eb5f9f6220851e90f350eba0a10f07c4afe51c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Minelli?= <michael@minelli.me> Date: Fri, 13 Oct 2023 12:34:06 +0200 Subject: [PATCH] CLI => Change commands folder structure --- .../commander/assignment/AssignmentCommand.ts | 6 +-- .../AssignmentCreateCommand.ts | 17 +++---- .../AssignmentPublishCommand.ts | 0 .../AssignmentPublishUnpublishCommandBase.ts | 21 +++----- .../AssignmentUnpublishCommand.ts | 0 .../src/commander/exercise/ExerciseCommand.ts | 4 +- .../ExerciseCreateCommand.ts | 23 ++++----- .../{ => subcommands}/ExerciseRunCommand.ts | 49 +++++++------------ .../src/commander/session/SessionCommand.ts | 6 +-- .../{App => subcommands}/SessionAppCommand.ts | 4 +- .../SessionGitlabCommand.ts | 4 +- .../{ => subcommands}/SessionTestCommand.ts | 6 +-- .../application}/SessionAppLoginCommand.ts | 9 ++-- .../application}/SessionAppLogoutCommand.ts | 9 ++-- .../gitlab}/SessionGitlabLoginCommand.ts | 9 ++-- .../gitlab}/SessionGitlabLogoutCommand.ts | 9 ++-- 16 files changed, 72 insertions(+), 104 deletions(-) rename NodeApp/src/commander/assignment/{ => subcommands}/AssignmentCreateCommand.ts (85%) rename NodeApp/src/commander/assignment/{ => subcommands}/AssignmentPublishCommand.ts (100%) rename NodeApp/src/commander/assignment/{ => subcommands}/AssignmentPublishUnpublishCommandBase.ts (72%) rename NodeApp/src/commander/assignment/{ => subcommands}/AssignmentUnpublishCommand.ts (100%) rename NodeApp/src/commander/exercise/{ => subcommands}/ExerciseCreateCommand.ts (79%) rename NodeApp/src/commander/exercise/{ => subcommands}/ExerciseRunCommand.ts (82%) rename NodeApp/src/commander/session/{App => subcommands}/SessionAppCommand.ts (78%) rename NodeApp/src/commander/session/{Gitlab => subcommands}/SessionGitlabCommand.ts (78%) rename NodeApp/src/commander/session/{ => subcommands}/SessionTestCommand.ts (72%) rename NodeApp/src/commander/session/{App => subcommands/application}/SessionAppLoginCommand.ts (71%) rename NodeApp/src/commander/session/{App => subcommands/application}/SessionAppLogoutCommand.ts (72%) rename NodeApp/src/commander/session/{Gitlab => subcommands/gitlab}/SessionGitlabLoginCommand.ts (67%) rename NodeApp/src/commander/session/{Gitlab => subcommands/gitlab}/SessionGitlabLogoutCommand.ts (72%) diff --git a/NodeApp/src/commander/assignment/AssignmentCommand.ts b/NodeApp/src/commander/assignment/AssignmentCommand.ts index c629ddc..3363dd7 100644 --- a/NodeApp/src/commander/assignment/AssignmentCommand.ts +++ b/NodeApp/src/commander/assignment/AssignmentCommand.ts @@ -1,7 +1,7 @@ import CommanderCommand from '../CommanderCommand'; -import AssignmentCreateCommand from './AssignmentCreateCommand'; -import AssignmentPublishCommand from './AssignmentPublishCommand'; -import AssignmentUnpublishCommand from './AssignmentUnpublishCommand'; +import AssignmentCreateCommand from './subcommands/AssignmentCreateCommand'; +import AssignmentPublishCommand from './subcommands/AssignmentPublishCommand'; +import AssignmentUnpublishCommand from './subcommands/AssignmentUnpublishCommand'; class AssignmentCommand extends CommanderCommand { diff --git a/NodeApp/src/commander/assignment/AssignmentCreateCommand.ts b/NodeApp/src/commander/assignment/subcommands/AssignmentCreateCommand.ts similarity index 85% rename from NodeApp/src/commander/assignment/AssignmentCreateCommand.ts rename to NodeApp/src/commander/assignment/subcommands/AssignmentCreateCommand.ts index c2b384a..0b28a1c 100644 --- a/NodeApp/src/commander/assignment/AssignmentCreateCommand.ts +++ b/NodeApp/src/commander/assignment/subcommands/AssignmentCreateCommand.ts @@ -1,12 +1,12 @@ -import CommanderCommand from '../CommanderCommand'; +import CommanderCommand from '../../CommanderCommand'; import chalk from 'chalk'; import ora from 'ora'; -import GitlabManager from '../../managers/GitlabManager'; -import GitlabUser from '../../shared/types/Gitlab/GitlabUser'; -import DojoBackendManager from '../../managers/DojoBackendManager'; -import Toolbox from '../../shared/helpers/Toolbox'; -import AccessesHelper from '../../helpers/AccessesHelper'; -import Assignment from '../../sharedByClients/models/Assignment'; +import GitlabManager from '../../../managers/GitlabManager'; +import GitlabUser from '../../../shared/types/Gitlab/GitlabUser'; +import DojoBackendManager from '../../../managers/DojoBackendManager'; +import Toolbox from '../../../shared/helpers/Toolbox'; +import AccessesHelper from '../../../helpers/AccessesHelper'; +import Assignment from '../../../sharedByClients/models/Assignment'; class AssignmentCreateCommand extends CommanderCommand { @@ -68,8 +68,7 @@ class AssignmentCreateCommand extends CommanderCommand { const oraInfo = (message: string) => { ora({ - text : message, - indent: 4 + text: message, indent: 4 }).start().info(); }; diff --git a/NodeApp/src/commander/assignment/AssignmentPublishCommand.ts b/NodeApp/src/commander/assignment/subcommands/AssignmentPublishCommand.ts similarity index 100% rename from NodeApp/src/commander/assignment/AssignmentPublishCommand.ts rename to NodeApp/src/commander/assignment/subcommands/AssignmentPublishCommand.ts diff --git a/NodeApp/src/commander/assignment/AssignmentPublishUnpublishCommandBase.ts b/NodeApp/src/commander/assignment/subcommands/AssignmentPublishUnpublishCommandBase.ts similarity index 72% rename from NodeApp/src/commander/assignment/AssignmentPublishUnpublishCommandBase.ts rename to NodeApp/src/commander/assignment/subcommands/AssignmentPublishUnpublishCommandBase.ts index b5df0c9..b828051 100644 --- a/NodeApp/src/commander/assignment/AssignmentPublishUnpublishCommandBase.ts +++ b/NodeApp/src/commander/assignment/subcommands/AssignmentPublishUnpublishCommandBase.ts @@ -1,10 +1,10 @@ -import CommanderCommand from '../CommanderCommand'; +import CommanderCommand from '../../CommanderCommand'; import inquirer from 'inquirer'; import chalk from 'chalk'; -import SessionManager from '../../managers/SessionManager'; +import SessionManager from '../../../managers/SessionManager'; import ora from 'ora'; -import DojoBackendManager from '../../managers/DojoBackendManager'; -import Assignment from '../../sharedByClients/models/Assignment'; +import DojoBackendManager from '../../../managers/DojoBackendManager'; +import Assignment from '../../../sharedByClients/models/Assignment'; abstract class AssignmentPublishUnpublishCommandBase extends CommanderCommand { @@ -21,9 +21,7 @@ abstract class AssignmentPublishUnpublishCommandBase extends CommanderCommand { protected async commandAction(assignmentNameOrUrl: string, options: { force: boolean }): Promise<void> { if ( !options.force ) { options.force = (await inquirer.prompt({ - type : 'confirm', - name : 'force', - message: this.publish ? 'Are you sure you want to publish this assignment?' : 'Are you sure you want to unpublish this assignment?' + type: 'confirm', name: 'force', message: this.publish ? 'Are you sure you want to publish this assignment?' : 'Are you sure you want to unpublish this assignment?' })).force; } @@ -42,12 +40,10 @@ abstract class AssignmentPublishUnpublishCommandBase extends CommanderCommand { ora('Checking assignment:').start().info(); ora({ - text : assignmentNameOrUrl, - indent: 4 + text: assignmentNameOrUrl, indent: 4 }).start().info(); const assignmentGetSpinner: ora.Ora = ora({ - text : 'Checking if assignment exists', - indent: 8 + text: 'Checking if assignment exists', indent: 8 }).start(); assignment = await DojoBackendManager.getAssignment(assignmentNameOrUrl); if ( !assignment ) { @@ -57,8 +53,7 @@ abstract class AssignmentPublishUnpublishCommandBase extends CommanderCommand { assignmentGetSpinner.succeed(`The assignment exists`); const assignmentCheckAccessSpinner: ora.Ora = ora({ - text : 'Checking accesses', - indent: 8 + text: 'Checking accesses', indent: 8 }).start(); if ( !assignment.staff ) { assignmentCheckAccessSpinner.fail(`You are not in the staff of this assignment`); diff --git a/NodeApp/src/commander/assignment/AssignmentUnpublishCommand.ts b/NodeApp/src/commander/assignment/subcommands/AssignmentUnpublishCommand.ts similarity index 100% rename from NodeApp/src/commander/assignment/AssignmentUnpublishCommand.ts rename to NodeApp/src/commander/assignment/subcommands/AssignmentUnpublishCommand.ts diff --git a/NodeApp/src/commander/exercise/ExerciseCommand.ts b/NodeApp/src/commander/exercise/ExerciseCommand.ts index ef2c3f2..bc122a8 100644 --- a/NodeApp/src/commander/exercise/ExerciseCommand.ts +++ b/NodeApp/src/commander/exercise/ExerciseCommand.ts @@ -1,6 +1,6 @@ import CommanderCommand from '../CommanderCommand'; -import ExerciseCreateCommand from './ExerciseCreateCommand'; -import ExerciseRunCommand from './ExerciseRunCommand'; +import ExerciseCreateCommand from './subcommands/ExerciseCreateCommand'; +import ExerciseRunCommand from './subcommands/ExerciseRunCommand'; class ExerciseCommand extends CommanderCommand { diff --git a/NodeApp/src/commander/exercise/ExerciseCreateCommand.ts b/NodeApp/src/commander/exercise/subcommands/ExerciseCreateCommand.ts similarity index 79% rename from NodeApp/src/commander/exercise/ExerciseCreateCommand.ts rename to NodeApp/src/commander/exercise/subcommands/ExerciseCreateCommand.ts index 9116ff3..bb51c2e 100644 --- a/NodeApp/src/commander/exercise/ExerciseCreateCommand.ts +++ b/NodeApp/src/commander/exercise/subcommands/ExerciseCreateCommand.ts @@ -1,12 +1,12 @@ -import CommanderCommand from '../CommanderCommand'; +import CommanderCommand from '../../CommanderCommand'; import chalk from 'chalk'; -import GitlabManager from '../../managers/GitlabManager'; -import GitlabUser from '../../shared/types/Gitlab/GitlabUser'; +import GitlabManager from '../../../managers/GitlabManager'; +import GitlabUser from '../../../shared/types/Gitlab/GitlabUser'; import ora from 'ora'; -import DojoBackendManager from '../../managers/DojoBackendManager'; -import AccessesHelper from '../../helpers/AccessesHelper'; -import Assignment from '../../sharedByClients/models/Assignment'; -import Exercise from '../../sharedByClients/models/Exercise'; +import DojoBackendManager from '../../../managers/DojoBackendManager'; +import AccessesHelper from '../../../helpers/AccessesHelper'; +import Assignment from '../../../sharedByClients/models/Assignment'; +import Exercise from '../../../sharedByClients/models/Exercise'; class ExerciseCreateCommand extends CommanderCommand { @@ -40,8 +40,7 @@ class ExerciseCreateCommand extends CommanderCommand { ora('Checking assignment:').start().info(); const assignmentGetSpinner: ora.Ora = ora({ - text : 'Checking if assignment exists', - indent: 4 + text: 'Checking if assignment exists', indent: 4 }).start(); assignment = await DojoBackendManager.getAssignment(options.assignment); if ( !assignment ) { @@ -51,8 +50,7 @@ class ExerciseCreateCommand extends CommanderCommand { assignmentGetSpinner.succeed(`Assignment "${ options.assignment }" exists`); const assignmentPublishedSpinner: ora.Ora = ora({ - text : 'Checking if assignment is published', - indent: 4 + text: 'Checking if assignment is published', indent: 4 }).start(); if ( !assignment.published ) { assignmentPublishedSpinner.fail(`Assignment "${ assignment.name }" isn't published`); @@ -70,8 +68,7 @@ class ExerciseCreateCommand extends CommanderCommand { const oraInfo = (message: string) => { ora({ - text : message, - indent: 4 + text: message, indent: 4 }).start().info(); }; diff --git a/NodeApp/src/commander/exercise/ExerciseRunCommand.ts b/NodeApp/src/commander/exercise/subcommands/ExerciseRunCommand.ts similarity index 82% rename from NodeApp/src/commander/exercise/ExerciseRunCommand.ts rename to NodeApp/src/commander/exercise/subcommands/ExerciseRunCommand.ts index 884de3c..bac1eb1 100644 --- a/NodeApp/src/commander/exercise/ExerciseRunCommand.ts +++ b/NodeApp/src/commander/exercise/subcommands/ExerciseRunCommand.ts @@ -1,5 +1,5 @@ -import CommanderCommand from '../CommanderCommand'; -import Config from '../../config/Config'; +import CommanderCommand from '../../CommanderCommand'; +import Config from '../../../config/Config'; import fs from 'node:fs'; import ora from 'ora'; import util from 'util'; @@ -7,13 +7,13 @@ import { exec } from 'child_process'; import chalk from 'chalk'; import * as os from 'os'; import path from 'path'; -import ClientsSharedConfig from '../../sharedByClients/config/ClientsSharedConfig'; -import AssignmentFile from '../../shared/types/Dojo/AssignmentFile'; -import ExerciseDockerCompose from '../../sharedByClients/helpers/Dojo/ExerciseDockerCompose'; -import SharedAssignmentHelper from '../../shared/helpers/Dojo/SharedAssignmentHelper'; -import ExerciseCheckerError from '../../shared/types/Dojo/ExerciseCheckerError'; -import ClientsSharedExerciseHelper from '../../sharedByClients/helpers/Dojo/ClientsSharedExerciseHelper'; -import ExerciseResultsSanitizerAndValidator from '../../sharedByClients/helpers/Dojo/ExerciseResultsSanitizerAndValidator'; +import ClientsSharedConfig from '../../../sharedByClients/config/ClientsSharedConfig'; +import AssignmentFile from '../../../shared/types/Dojo/AssignmentFile'; +import ExerciseDockerCompose from '../../../sharedByClients/helpers/Dojo/ExerciseDockerCompose'; +import SharedAssignmentHelper from '../../../shared/helpers/Dojo/SharedAssignmentHelper'; +import ExerciseCheckerError from '../../../shared/types/Dojo/ExerciseCheckerError'; +import ClientsSharedExerciseHelper from '../../../sharedByClients/helpers/Dojo/ClientsSharedExerciseHelper'; +import ExerciseResultsSanitizerAndValidator from '../../../sharedByClients/helpers/Dojo/ExerciseResultsSanitizerAndValidator'; const execAsync = util.promisify(exec); @@ -42,8 +42,7 @@ class ExerciseRunCommand extends CommanderCommand { private displayExecutionLogs() { ora({ - text : `${ chalk.magenta('Execution logs folder:') } ${ this.folderResultsVolume }`, - indent: 0 + text: `${ chalk.magenta('Execution logs folder:') } ${ this.folderResultsVolume }`, indent: 0 }).start().info(); } @@ -67,15 +66,13 @@ class ExerciseRunCommand extends CommanderCommand { ora({ - text : `Checking exercise content:`, - indent: 4 + text: `Checking exercise content:`, indent: 4 }).start().info(); // Exercise folder { const spinner: ora.Ora = ora({ - text : `Checking exercise folder`, - indent: 8 + text: `Checking exercise folder`, indent: 8 }).start(); const files = fs.readdirSync(options.path); @@ -92,8 +89,7 @@ class ExerciseRunCommand extends CommanderCommand { // dojo_assignment.json validity { const spinner: ora.Ora = ora({ - text : `Checking ${ ClientsSharedConfig.assignment.filename } file`, - indent: 8 + text: `Checking ${ ClientsSharedConfig.assignment.filename } file`, indent: 8 }).start(); const validationResults = SharedAssignmentHelper.validateDescriptionFile(path.join(options.path, ClientsSharedConfig.assignment.filename)); @@ -112,8 +108,7 @@ class ExerciseRunCommand extends CommanderCommand { // Docker daemon { const spinner: ora.Ora = ora({ - text : `Checking Docker daemon`, - indent: 4 + text: `Checking Docker daemon`, indent: 4 }).start(); try { @@ -157,8 +152,7 @@ class ExerciseRunCommand extends CommanderCommand { exerciseDockerCompose.events.on('step', (name: string, message: string) => { spinner = ora({ - text : message, - indent: 4 + text: message, indent: 4 }).start(); if ( options.verbose && name == 'COMPOSE_RUN' ) { @@ -170,8 +164,7 @@ class ExerciseRunCommand extends CommanderCommand { if ( error ) { if ( options.verbose && stepName == 'COMPOSE_RUN' ) { ora({ - text : message, - indent: 4 + text: message, indent: 4 }).start().fail(); } else { spinner.fail(message); @@ -179,8 +172,7 @@ class ExerciseRunCommand extends CommanderCommand { } else { if ( options.verbose && stepName == 'COMPOSE_RUN' ) { ora({ - text : message, - indent: 4 + text: message, indent: 4 }).start().succeed(); } else { spinner.succeed(message); @@ -218,8 +210,7 @@ class ExerciseRunCommand extends CommanderCommand { exerciseResultsValidation.events.on('step', (name: string, message: string) => { spinner = ora({ - text : message, - indent: 4 + text: message, indent: 4 }).start(); }); @@ -251,9 +242,7 @@ class ExerciseRunCommand extends CommanderCommand { // Step 4: Display results + Volume location { ClientsSharedExerciseHelper.displayExecutionResults(exerciseResultsValidation.exerciseResults!, exerciseDockerCompose.exitCode, { - INFO : chalk.bold, - SUCCESS: chalk.green, - FAILURE: chalk.red + INFO: chalk.bold, SUCCESS: chalk.green, FAILURE: chalk.red }, `\n\n${ chalk.bold('Execution results folder') } : ${ this.folderResultsVolume }`); } } diff --git a/NodeApp/src/commander/session/SessionCommand.ts b/NodeApp/src/commander/session/SessionCommand.ts index c7089d6..8ec1685 100644 --- a/NodeApp/src/commander/session/SessionCommand.ts +++ b/NodeApp/src/commander/session/SessionCommand.ts @@ -1,7 +1,7 @@ import CommanderCommand from '../CommanderCommand'; -import SessionTestCommand from './SessionTestCommand'; -import SessionAppCommand from './App/SessionAppCommand'; -import SessionGitlabCommand from './Gitlab/SessionGitlabCommand'; +import SessionTestCommand from './subcommands/SessionTestCommand'; +import SessionAppCommand from './subcommands/SessionAppCommand'; +import SessionGitlabCommand from './subcommands/SessionGitlabCommand'; class SessionCommand extends CommanderCommand { diff --git a/NodeApp/src/commander/session/App/SessionAppCommand.ts b/NodeApp/src/commander/session/subcommands/SessionAppCommand.ts similarity index 78% rename from NodeApp/src/commander/session/App/SessionAppCommand.ts rename to NodeApp/src/commander/session/subcommands/SessionAppCommand.ts index d0c943b..f8d179e 100644 --- a/NodeApp/src/commander/session/App/SessionAppCommand.ts +++ b/NodeApp/src/commander/session/subcommands/SessionAppCommand.ts @@ -1,6 +1,6 @@ import CommanderCommand from '../../CommanderCommand'; -import SessionAppLoginCommand from './SessionAppLoginCommand'; -import SessionAppLogoutCommand from './SessionAppLogoutCommand'; +import SessionAppLoginCommand from './application/SessionAppLoginCommand'; +import SessionAppLogoutCommand from './application/SessionAppLogoutCommand'; class SessionAppCommand extends CommanderCommand { diff --git a/NodeApp/src/commander/session/Gitlab/SessionGitlabCommand.ts b/NodeApp/src/commander/session/subcommands/SessionGitlabCommand.ts similarity index 78% rename from NodeApp/src/commander/session/Gitlab/SessionGitlabCommand.ts rename to NodeApp/src/commander/session/subcommands/SessionGitlabCommand.ts index 3662faa..e80ceb2 100644 --- a/NodeApp/src/commander/session/Gitlab/SessionGitlabCommand.ts +++ b/NodeApp/src/commander/session/subcommands/SessionGitlabCommand.ts @@ -1,6 +1,6 @@ import CommanderCommand from '../../CommanderCommand'; -import SessionGitlabLoginCommand from './SessionGitlabLoginCommand'; -import SessionGitlabLogoutCommand from './SessionGitlabLogoutCommand'; +import SessionGitlabLoginCommand from './gitlab/SessionGitlabLoginCommand'; +import SessionGitlabLogoutCommand from './gitlab/SessionGitlabLogoutCommand'; class SessionGitlabCommand extends CommanderCommand { diff --git a/NodeApp/src/commander/session/SessionTestCommand.ts b/NodeApp/src/commander/session/subcommands/SessionTestCommand.ts similarity index 72% rename from NodeApp/src/commander/session/SessionTestCommand.ts rename to NodeApp/src/commander/session/subcommands/SessionTestCommand.ts index d0ab1b6..57c1bf0 100644 --- a/NodeApp/src/commander/session/SessionTestCommand.ts +++ b/NodeApp/src/commander/session/subcommands/SessionTestCommand.ts @@ -1,6 +1,6 @@ -import CommanderCommand from '../CommanderCommand'; -import SessionManager from '../../managers/SessionManager'; -import GitlabManager from '../../managers/GitlabManager'; +import CommanderCommand from '../../CommanderCommand'; +import SessionManager from '../../../managers/SessionManager'; +import GitlabManager from '../../../managers/GitlabManager'; class SessionTestCommand extends CommanderCommand { diff --git a/NodeApp/src/commander/session/App/SessionAppLoginCommand.ts b/NodeApp/src/commander/session/subcommands/application/SessionAppLoginCommand.ts similarity index 71% rename from NodeApp/src/commander/session/App/SessionAppLoginCommand.ts rename to NodeApp/src/commander/session/subcommands/application/SessionAppLoginCommand.ts index 58bc031..88deb2e 100644 --- a/NodeApp/src/commander/session/App/SessionAppLoginCommand.ts +++ b/NodeApp/src/commander/session/subcommands/application/SessionAppLoginCommand.ts @@ -1,7 +1,7 @@ import chalk from 'chalk'; -import CommanderCommand from '../../CommanderCommand'; +import CommanderCommand from '../../../CommanderCommand'; import inquirer from 'inquirer'; -import SessionManager from '../../../managers/SessionManager'; +import SessionManager from '../../../../managers/SessionManager'; class SessionAppLoginCommand extends CommanderCommand { @@ -18,10 +18,7 @@ class SessionAppLoginCommand extends CommanderCommand { protected async commandAction(options: { user: string, password: string }): Promise<void> { if ( !options.password ) { options.password = (await inquirer.prompt({ - type : 'password', - name : 'password', - message: 'Please enter your password', - mask : '' + type: 'password', name: 'password', message: 'Please enter your password', mask: '' })).password; } diff --git a/NodeApp/src/commander/session/App/SessionAppLogoutCommand.ts b/NodeApp/src/commander/session/subcommands/application/SessionAppLogoutCommand.ts similarity index 72% rename from NodeApp/src/commander/session/App/SessionAppLogoutCommand.ts rename to NodeApp/src/commander/session/subcommands/application/SessionAppLogoutCommand.ts index 650440d..7d051a3 100644 --- a/NodeApp/src/commander/session/App/SessionAppLogoutCommand.ts +++ b/NodeApp/src/commander/session/subcommands/application/SessionAppLogoutCommand.ts @@ -1,6 +1,6 @@ -import CommanderCommand from '../../CommanderCommand'; +import CommanderCommand from '../../../CommanderCommand'; import inquirer from 'inquirer'; -import SessionManager from '../../../managers/SessionManager'; +import SessionManager from '../../../../managers/SessionManager'; import ora from 'ora'; @@ -17,10 +17,7 @@ class SessionAppLogoutCommand extends CommanderCommand { protected async commandAction(options: any): Promise<void> { if ( !options.force ) { const confirm: boolean = (await inquirer.prompt({ - name : 'confirm', - message: 'Are you sure?', - type : 'confirm', - default: false + name: 'confirm', message: 'Are you sure?', type: 'confirm', default: false })).confirm; if ( !confirm ) { diff --git a/NodeApp/src/commander/session/Gitlab/SessionGitlabLoginCommand.ts b/NodeApp/src/commander/session/subcommands/gitlab/SessionGitlabLoginCommand.ts similarity index 67% rename from NodeApp/src/commander/session/Gitlab/SessionGitlabLoginCommand.ts rename to NodeApp/src/commander/session/subcommands/gitlab/SessionGitlabLoginCommand.ts index e76525e..fae91b6 100644 --- a/NodeApp/src/commander/session/Gitlab/SessionGitlabLoginCommand.ts +++ b/NodeApp/src/commander/session/subcommands/gitlab/SessionGitlabLoginCommand.ts @@ -1,6 +1,6 @@ import chalk from 'chalk'; -import CommanderCommand from '../../CommanderCommand'; -import GitlabManager from '../../../managers/GitlabManager'; +import CommanderCommand from '../../../CommanderCommand'; +import GitlabManager from '../../../../managers/GitlabManager'; import inquirer from 'inquirer'; @@ -17,10 +17,7 @@ class SessionGitlabLoginCommand extends CommanderCommand { protected async commandAction(options: { token: string }): Promise<void> { if ( !options.token ) { options.token = (await inquirer.prompt({ - type : 'password', - name : 'token', - message: 'Please enter your gitlab token', - mask : '' + type: 'password', name: 'token', message: 'Please enter your gitlab token', mask: '' })).token; } diff --git a/NodeApp/src/commander/session/Gitlab/SessionGitlabLogoutCommand.ts b/NodeApp/src/commander/session/subcommands/gitlab/SessionGitlabLogoutCommand.ts similarity index 72% rename from NodeApp/src/commander/session/Gitlab/SessionGitlabLogoutCommand.ts rename to NodeApp/src/commander/session/subcommands/gitlab/SessionGitlabLogoutCommand.ts index 6b86883..4d43d37 100644 --- a/NodeApp/src/commander/session/Gitlab/SessionGitlabLogoutCommand.ts +++ b/NodeApp/src/commander/session/subcommands/gitlab/SessionGitlabLogoutCommand.ts @@ -1,7 +1,7 @@ -import CommanderCommand from '../../CommanderCommand'; +import CommanderCommand from '../../../CommanderCommand'; import inquirer from 'inquirer'; import ora from 'ora'; -import GitlabManager from '../../../managers/GitlabManager'; +import GitlabManager from '../../../../managers/GitlabManager'; class SessionGitlabLogoutCommand extends CommanderCommand { @@ -17,10 +17,7 @@ class SessionGitlabLogoutCommand extends CommanderCommand { protected async commandAction(options: any): Promise<void> { if ( !options.force ) { const confirm: boolean = (await inquirer.prompt({ - name : 'confirm', - message: 'Are you sure?', - type : 'confirm', - default: false + name: 'confirm', message: 'Are you sure?', type: 'confirm', default: false })).confirm; if ( !confirm ) { -- GitLab