Skip to content

Name the CLI after the command word it was invoked as - #207

Merged
ysyneu merged 2 commits into
feat/skill-command-namefrom
fix/invoked-command-name
Oct 8, 2026
Merged

ysyneu merged 2 commits into
feat/skill-command-namefrom
fix/invoked-command-name

Conversation

@ysyneu

@ysyneu ysyneu commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • The root command's name is now the basename of os.Args[0] (.exe stripped, falling back to flashduty), resolved once in cmd/flashduty/main.go and passed to cli.Execute(name). A copy installed under another name (INSTALLED_NAME) shows that name in --help, examples, flag usages, errors, update notices and completion scripts.
  • Help and error text stays authored with the canonical flashduty. Under any other name, Execute rewrites the command-word flashduty (followed by a space; not part of go-flashduty, ~/.flashduty, a path or a domain) across the tree's Short/Long/Example/flag usages and in the returned error. Under the default name the tree runs unchanged; RootForDump() and tests never go through Execute, so they stay on flashduty.
  • install.sh no longer pipes completion through sed: the installed binary generates it under its own name. (install.ps1 has no completion step.)
  • Four help strings that named the CLI fduty now say flashduty.
  • skills/flashduty/** calls the CLI flashduty (302 occurrences, prose and scripts/incident-summary.sh); the generated-fence marker changes accordingly and the fences were regenerated. The install fallback in SKILL.md drops INSTALLED_NAME= and installs under the default name.
  • flashduty version's plain line keeps the flashduty version ... prefix whatever the invoked name, because downstream checks grep for it.

Verification

  • make check (fmt, golangci-lint 0 issues, all tests, build) passes; go run ./internal/cmd/skilldoc check → cards OK.
  • Built binary copied as fduty: fduty --help → Usage: fduty [command], 'fduty login'; fduty incident list --help → fduty incident list [flags], See also: fduty insight ...; fduty completion zsh → #compdef fduty, bash → complete -o default -F __start_fduty fduty, fish → complete -c fduty, zero flashduty lines in the zsh/bash scripts; missing-key error → Run 'fduty login'. The same checks under flashduty show flashduty.
  • __dump-commands output differs from main only in the three strings that used to say fduty.

🤖 Generated with Claude Code

ysyneu added 2 commits October 8, 2026 05:06
The root command now takes its name from os.Args[0], so a copy installed
under another name (install.sh INSTALLED_NAME) shows that name in help,
examples, flag usages, errors, update notices and completion scripts.
Help and error text stays authored with the canonical "flashduty" and is
rewritten to the invoked name at startup; the default name runs the tree
unchanged.

Completion scripts are now generated by the installed binary under its
own name, so install.sh no longer rewrites them with sed.

The bundled skill and its scripts now call the CLI by its default name,
flashduty, and help strings that used another name now use flashduty.
`update` now resolves the running binary (os.Executable, symlinks
resolved) and passes its directory and file name to the installer as
FLASHDUTY_INSTALL_DIR and INSTALLED_NAME, so a copy installed under
another name or directory is replaced in place instead of a fresh
default-named copy being installed elsewhere.

install.ps1 honors INSTALLED_NAME and moves an existing .exe aside
before installing, since Windows cannot overwrite a running executable.

Also: treat "$" in the invoked name literally when rewriting help text,
strip the ".exe" suffix case-insensitively, and note why the version
line keeps its fixed "flashduty version" prefix.
@ysyneu
ysyneu merged commit 2ef1996 into feat/skill-command-name Oct 8, 2026
14 checks passed
@ysyneu
ysyneu deleted the fix/invoked-command-name branch October 8, 2026 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant