@travetto/cli 3.0.0-rc.11 → 3.0.0-rc.13

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/cli",
3
- "version": "3.0.0-rc.11",
3
+ "version": "3.0.0-rc.13",
4
4
  "description": "CLI infrastructure for travetto framework",
5
5
  "keywords": [
6
6
  "cli",
@@ -26,9 +26,9 @@
26
26
  "directory": "module/cli"
27
27
  },
28
28
  "dependencies": {
29
- "@travetto/base": "^3.0.0-rc.10",
30
- "@travetto/terminal": "^3.0.0-rc.6",
31
- "@travetto/worker": "^3.0.0-rc.10",
29
+ "@travetto/base": "^3.0.0-rc.12",
30
+ "@travetto/terminal": "^3.0.0-rc.7",
31
+ "@travetto/worker": "^3.0.0-rc.12",
32
32
  "commander": "^10.0.0"
33
33
  },
34
34
  "travetto": {
package/src/command.ts CHANGED
@@ -221,13 +221,14 @@ export abstract class CliCommand<V extends OptionMap = OptionMap> {
221
221
  if (args) {
222
222
  cmd = cmd.arguments(args);
223
223
  }
224
+
224
225
  for (const cfg of await this.finalizeOptions()) {
225
226
  const pre = cfg.short ? `-${cfg.short}, ` : '';
226
227
  if (cfg.type === Boolean) {
227
228
  if (cfg.def) {
228
- cmd.option(`${pre}--no-${cfg.name}`, `Disables: ${cfg.desc}`);
229
+ cmd = cmd.option(`${pre}--no-${cfg.name}`, `Disables: ${cfg.desc}`);
229
230
  } else {
230
- cmd.option(`${pre}--${cfg.name}`, cfg.desc);
231
+ cmd = cmd.option(`${pre}--${cfg.name}`, cfg.desc);
231
232
  }
232
233
  } else {
233
234
  const key = `${pre}--${cfg.name} <${cfg.name}>`;
@@ -238,6 +239,9 @@ export abstract class CliCommand<V extends OptionMap = OptionMap> {
238
239
 
239
240
  cmd = cmd.action(this.runAction.bind(this));
240
241
 
242
+ // @ts-expect-error, Do nothing
243
+ cmd.missingArgument = (): void => { };
244
+
241
245
  return this.#cmd = cmd;
242
246
  }
243
247
 
@@ -37,11 +37,15 @@ export class RepoExecCommand extends CliCommand<Options> {
37
37
  return { debug: false };
38
38
  }
39
39
 
40
- async action(): Promise<void> {
40
+ async action(cmd: string, args: string[]): Promise<void> {
41
+ if (!cmd) {
42
+ return this.showHelp('Command is a required field');
43
+ }
44
+
41
45
  await CliModuleUtil.execOnModules(
42
46
  this.cmd.changed ? 'changed' : 'all',
43
47
  // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
44
- (mod, opts) => ExecUtil.spawn(this.args[0], this.args.slice(1), opts),
48
+ (mod, opts) => ExecUtil.spawn(cmd, args, opts),
45
49
  {
46
50
  progressMessage: mod => `Running '${this.args.join(' ')}' [%idx/%total] ${mod?.sourceFolder ?? ''}`,
47
51
  showStdout: this.cmd.showStdout,