From 99a0a9ca8185905400139dc97d4798f71a7b3c08 Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Wed, 3 Aug 2022 20:21:54 +0200 Subject: [PATCH] fix(core): update --- ts/00_commitinfo_data.ts | 2 +- ts/smartcli.classes.smartcli.ts | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 5a860bb..20047ea 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@pushrocks/smartcli', - version: '4.0.3', + version: '4.0.4', description: 'easy observable cli tasks' } diff --git a/ts/smartcli.classes.smartcli.ts b/ts/smartcli.classes.smartcli.ts index fda9297..dcea4b2 100644 --- a/ts/smartcli.classes.smartcli.ts +++ b/ts/smartcli.classes.smartcli.ts @@ -95,12 +95,6 @@ export class Smartcli { */ public addVersion(versionArg: string) { this.version = versionArg; - this.addCommandAlias('v', 'version'); - this.parseCompleted.promise.then((argv) => { - if (argv.v) { - console.log(this.version); - } - }); } /** @@ -133,8 +127,15 @@ export class Smartcli { return true; } }); + const wantedCommand = parsedYArgs._[0]; + + // lets handle some standards + if (!wantedCommand && (parsedYArgs.v || parsedYArgs.version)) { + console.log(this.version || 'unknown version'); + return; + } + for (const command of this.commandObservableMap.getArray()) { - const wantedCommand = parsedYArgs._[0]; if (!wantedCommand) { const standardCommand = this.commandObservableMap.findSync((commandArg) => { return commandArg.commandName === 'standardCommand';