Skip to content

Commit 9c737a9

Browse files
committed
feat(cli): name the binary in --version output
1 parent b5d1717 commit 9c737a9

3 files changed

Lines changed: 7 additions & 6 deletions

File tree

‎docs/IMPLEMENTATION.md‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,6 @@ This release changes no settings, OAuth-store, or session persistence format and
404404

405405
Printed by `corbits --help` / `-h` from `CLI_HELP_TEXT` in `src/config/index.ts`
406406
(that constant is the source of truth; keep this table in sync when flags change).
407-
`--version` / `-V` print `CLI_VERSION_TEXT` (the `package.json` version) and exit 0.
408407

409408
| Verb / Flag | Default | Description |
410409
| ------------------------------------------ | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
@@ -425,7 +424,7 @@ Printed by `corbits --help` / `-h` from `CLI_HELP_TEXT` in `src/config/index.ts`
425424
| `--auto` | true (default) | Force auto mode on (workspace writes + unconstrained shell without prompts) |
426425
| `--no-auto` | false | Start with auto mode off (ask on every consequential action); no in-session key toggles it |
427426
| `--help`, `-h` | — | Show help (exit 0 via `CliHelpError`) |
428-
| `--version`, `-V` | — | Print the running `package.json` version (exit 0 via `CliVersionError`) |
427+
| `--version`, `-V` | — | Print `corbits v` plus the running `package.json` version (exit 0 via `CliVersionError`) |
429428

430429
Positional arguments after flags are joined into the optional initial task delivered when the TUI mounts. With no positional task, the operator starts from an empty prompt.
431430

‎src/config.test.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@ async function expectCliVersion(argv: readonly string[]): Promise<void> {
212212
const version = err as CliVersionError;
213213
expect(version.exitCode).toBe(0);
214214
expect(version.message).toBe(CLI_VERSION_TEXT);
215-
expect(version.message).toBe(pkg.version);
215+
expect(version.message).toContain(pkg.version);
216+
expect(version.message).toBe(`corbits v${pkg.version}`);
216217
}
217218
}
218219

‎src/config/index.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ Flags:
737737
--config selects another source
738738
--auto / --no-auto auto mode on/off
739739
--help, -h show this help
740-
--version, -V print version
740+
--version, -V show version
741741
`;
742742

743743
/**
@@ -754,8 +754,9 @@ export class CliHelpError extends Error {
754754
}
755755

756756
/** Printed for `corbits --version` / `-V`. Matches `package.json` version. */
757-
export const CLI_VERSION_TEXT =
758-
typeof pkg.version === "string" ? pkg.version : "0.0.0";
757+
export const CLI_VERSION_TEXT = `${COMMAND_NAME} v${
758+
typeof pkg.version === "string" ? pkg.version : "0.0.0"
759+
}`;
759760

760761
/**
761762
* Thrown when the operator asked for the CLI version. Entry points must print

0 commit comments

Comments
 (0)