diff --git a/NodeApp/src/commander/CommanderApp.ts b/NodeApp/src/commander/CommanderApp.ts index f32b3d79c7495f13c06da4940f20b27ab0feec0f..9da832294078c3c474435505bc835414f2828ed4 100644 --- a/NodeApp/src/commander/CommanderApp.ts +++ b/NodeApp/src/commander/CommanderApp.ts @@ -1,5 +1,5 @@ import { Command, Option } from 'commander'; -import SessionCommand from './session/SessionCommand'; +import AuthCommand from './auth/AuthCommand'; import ClientsSharedConfig from '../sharedByClients/config/ClientsSharedConfig'; import AssignmentCommand from './assignment/AssignmentCommand'; import ExerciseCommand from './exercise/ExerciseCommand'; @@ -9,6 +9,7 @@ import { stateConfigFile } from '../config/ConfigFiles'; import semver from 'semver/preload'; import { version } from '../config/Version'; import Config from '../config/Config'; +import SessionCommand from './auth/SessionCommand'; class CommanderApp { @@ -90,6 +91,7 @@ https://gitedu.hesge.ch/dojo_project/projects/ui/dojocli/-/releases/Latest`, { } private registerCommands() { + new AuthCommand().registerOnCommand(this.program); SessionCommand.registerOnCommand(this.program); AssignmentCommand.registerOnCommand(this.program); ExerciseCommand.registerOnCommand(this.program); diff --git a/NodeApp/src/commander/session/SessionCommand.ts b/NodeApp/src/commander/auth/AuthCommand.ts similarity index 57% rename from NodeApp/src/commander/session/SessionCommand.ts rename to NodeApp/src/commander/auth/AuthCommand.ts index 6dff026f2eae88717b4ca3bebe53f2db8025e749..c5f4e00afdfa037f1f732c940fee25b34b401822 100644 --- a/NodeApp/src/commander/session/SessionCommand.ts +++ b/NodeApp/src/commander/auth/AuthCommand.ts @@ -1,11 +1,11 @@ import CommanderCommand from '../CommanderCommand'; -import SessionTestCommand from './subcommands/SessionTestCommand'; -import SessionLoginCommand from './subcommands/SessionLoginCommand'; -import SessionLogoutCommand from './subcommands/SessionLogoutCommand'; +import SessionTestCommand from './subcommands/AuthTestCommand'; +import SessionLoginCommand from './subcommands/AuthLoginCommand'; +import SessionLogoutCommand from './subcommands/AuthLogoutCommand'; -class SessionCommand extends CommanderCommand { - protected commandName: string = 'session'; +class AuthCommand extends CommanderCommand { + protected commandName: string = 'auth'; protected defineCommand() { this.command @@ -22,4 +22,4 @@ class SessionCommand extends CommanderCommand { } -export default new SessionCommand(); \ No newline at end of file +export default AuthCommand; \ No newline at end of file diff --git a/NodeApp/src/commander/auth/SessionCommand.ts b/NodeApp/src/commander/auth/SessionCommand.ts new file mode 100644 index 0000000000000000000000000000000000000000..75fe630a3063f23eda3b3abdfb9723752d26b3e2 --- /dev/null +++ b/NodeApp/src/commander/auth/SessionCommand.ts @@ -0,0 +1,13 @@ +import AuthCommand from './AuthCommand'; +import { CommandOptions } from 'commander'; + + +class SessionCommand extends AuthCommand { + protected commandName: string = 'session'; + protected options: CommandOptions = { + hidden: true + }; +} + + +export default new SessionCommand(); \ No newline at end of file diff --git a/NodeApp/src/commander/session/subcommands/SessionLoginCommand.ts b/NodeApp/src/commander/auth/subcommands/AuthLoginCommand.ts similarity index 88% rename from NodeApp/src/commander/session/subcommands/SessionLoginCommand.ts rename to NodeApp/src/commander/auth/subcommands/AuthLoginCommand.ts index d9061e261f67f35104d1836d75cc78adea55dbc1..3bc4586c766e63e8af321047cff7215b2bf692e2 100644 --- a/NodeApp/src/commander/session/subcommands/SessionLoginCommand.ts +++ b/NodeApp/src/commander/auth/subcommands/AuthLoginCommand.ts @@ -3,7 +3,7 @@ import CommanderCommand from '../../CommanderCommand'; import SessionManager from '../../../managers/SessionManager'; -class SessionLoginCommand extends CommanderCommand { +class AuthLoginCommand extends CommanderCommand { protected commandName: string = 'login'; protected defineCommand() { @@ -22,4 +22,4 @@ class SessionLoginCommand extends CommanderCommand { } -export default new SessionLoginCommand(); \ No newline at end of file +export default new AuthLoginCommand(); \ No newline at end of file diff --git a/NodeApp/src/commander/session/subcommands/SessionLogoutCommand.ts b/NodeApp/src/commander/auth/subcommands/AuthLogoutCommand.ts similarity index 93% rename from NodeApp/src/commander/session/subcommands/SessionLogoutCommand.ts rename to NodeApp/src/commander/auth/subcommands/AuthLogoutCommand.ts index e71d882d4935b8b3f8cc1b4f248a2a3d9ae6ab33..bce24448738c298661d03799bf315963852ca39e 100644 --- a/NodeApp/src/commander/session/subcommands/SessionLogoutCommand.ts +++ b/NodeApp/src/commander/auth/subcommands/AuthLogoutCommand.ts @@ -4,7 +4,7 @@ import ora from 'ora'; import SessionManager from '../../../managers/SessionManager'; -class SessionLogoutCommand extends CommanderCommand { +class AuthLogoutCommand extends CommanderCommand { protected commandName: string = 'logout'; protected defineCommand() { @@ -35,4 +35,4 @@ class SessionLogoutCommand extends CommanderCommand { } -export default new SessionLogoutCommand(); \ No newline at end of file +export default new AuthLogoutCommand(); \ No newline at end of file diff --git a/NodeApp/src/commander/session/subcommands/SessionTestCommand.ts b/NodeApp/src/commander/auth/subcommands/AuthTestCommand.ts similarity index 86% rename from NodeApp/src/commander/session/subcommands/SessionTestCommand.ts rename to NodeApp/src/commander/auth/subcommands/AuthTestCommand.ts index 57c1bf00b1ea126c17fddea14714d06effdbea40..d1f57e64ec809f5684fef9e09ae7c0869944cca5 100644 --- a/NodeApp/src/commander/session/subcommands/SessionTestCommand.ts +++ b/NodeApp/src/commander/auth/subcommands/AuthTestCommand.ts @@ -3,7 +3,7 @@ import SessionManager from '../../../managers/SessionManager'; import GitlabManager from '../../../managers/GitlabManager'; -class SessionTestCommand extends CommanderCommand { +class AuthTestCommand extends CommanderCommand { protected commandName: string = 'test'; protected defineCommand() { @@ -19,4 +19,4 @@ class SessionTestCommand extends CommanderCommand { } -export default new SessionTestCommand(); \ No newline at end of file +export default new AuthTestCommand(); \ No newline at end of file