@doguyilmaz/konvoy 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/args.ts +1 -1
- package/src/cli.ts +14 -2
package/package.json
CHANGED
package/src/args.ts
CHANGED
|
@@ -5,7 +5,7 @@ export interface Args {
|
|
|
5
5
|
|
|
6
6
|
// Flags that are switches, so `konvoy rm --yes <slug>` keeps its slug. Their consumers are the
|
|
7
7
|
// `=== true` checks in cli.ts; a value flag (--session, --port) is anything not listed here.
|
|
8
|
-
const SWITCHES = new Set(['all', 'yes', 'global', 'chart', 'help'])
|
|
8
|
+
const SWITCHES = new Set(['all', 'yes', 'global', 'chart', 'help', 'h', 'version', 'v', 'V'])
|
|
9
9
|
|
|
10
10
|
export function parseArgs(argv: string[]): Args {
|
|
11
11
|
const positional: string[] = []
|
package/src/cli.ts
CHANGED
|
@@ -35,7 +35,7 @@ export const USAGE = `konvoy ${VERSION}
|
|
|
35
35
|
${formatCommandList()}
|
|
36
36
|
|
|
37
37
|
agents: ${agentIds.join(', ')}
|
|
38
|
-
flags: --session <slug
|
|
38
|
+
flags: --session <slug>, --version (-v), --help (-h)
|
|
39
39
|
`
|
|
40
40
|
|
|
41
41
|
interface CommandContext {
|
|
@@ -129,10 +129,22 @@ export async function main(argv: string[], io: ReplIo = stdio()): Promise<number
|
|
|
129
129
|
const cwd = process.cwd()
|
|
130
130
|
const slug = typeof args.flags.session === 'string' ? args.flags.session : undefined
|
|
131
131
|
|
|
132
|
-
if (
|
|
132
|
+
if (args.flags.version === true || args.flags.v === true || args.flags.V === true) {
|
|
133
|
+
console.log(`konvoy ${VERSION}`)
|
|
134
|
+
return 0
|
|
135
|
+
}
|
|
136
|
+
if (command === 'help' || args.flags.help === true || args.flags.h === true) {
|
|
133
137
|
console.log(USAGE)
|
|
134
138
|
return 0
|
|
135
139
|
}
|
|
140
|
+
if (!command) {
|
|
141
|
+
const stray = Object.keys(args.flags).filter((f) => f !== 'session')
|
|
142
|
+
if (stray.length > 0) {
|
|
143
|
+
console.error(`unknown flag ${stray[0]!.length === 1 ? '-' : '--'}${stray[0]}`)
|
|
144
|
+
console.log(USAGE)
|
|
145
|
+
return 2
|
|
146
|
+
}
|
|
147
|
+
}
|
|
136
148
|
|
|
137
149
|
try {
|
|
138
150
|
return command ? await dispatch(command, rest, cwd, slug, args) : await interactive(io, cwd, slug)
|