diff --git a/src/m365/commands/version.ts b/src/m365/commands/version.ts index 3ecde84692d..8f3403832a7 100644 --- a/src/m365/commands/version.ts +++ b/src/m365/commands/version.ts @@ -1,19 +1,37 @@ -import { Logger } from '../../cli/Logger.js'; -import { app } from '../../utils/app.js'; -import AnonymousCommand from '../base/AnonymousCommand.js'; -import commands from './commands.js'; +import commands from '../commands.js'; +import { Logger } from '../../../cli/Logger.js'; +import Command, { CommandArgs, CommandOutput } from '../../Command.js'; +import { z } from 'zod'; +import { globalOptionsZod } from '../../Command.js'; +import app from '../../../utils/app.js'; -class VersionCommand extends AnonymousCommand { +/** + * Zod schema for the version command options. + * No additional options, just global options. + */ +export const options = globalOptionsZod.strict(); +type Options = z.infer; + +interface VersionCommandArgs extends CommandArgs { + options: Options; +} + +class VersionCommand extends Command { public get name(): string { return commands.VERSION; } public get description(): string { - return 'Shows CLI for Microsoft 365 version'; + return 'Shows CLI version'; + } + + public get schema(): z.ZodTypeAny | undefined { + return options; } - public async commandAction(logger: Logger): Promise { + public async commandAction(logger: Logger, args: VersionCommandArgs): Promise { await logger.log(`v${app.packageJson().version}`); + return; } }