Repository navigation
Name the CLI after the command word it was invoked as - #207
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
os.Args[0](.exestripped, falling back toflashduty), resolved once incmd/flashduty/main.goand passed tocli.Execute(name). A copy installed under another name (INSTALLED_NAME) shows that name in--help, examples, flag usages, errors, update notices and completion scripts.flashduty. Under any other name,Executerewrites the command-wordflashduty(followed by a space; not part ofgo-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 throughExecute, so they stay onflashduty.install.shno longer pipes completion throughsed: the installed binary generates it under its own name. (install.ps1has no completion step.)fdutynow sayflashduty.skills/flashduty/**calls the CLIflashduty(302 occurrences, prose andscripts/incident-summary.sh); the generated-fence marker changes accordingly and the fences were regenerated. The install fallback in SKILL.md dropsINSTALLED_NAME=and installs under the default name.flashduty version's plain line keeps theflashduty 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.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, zeroflashdutylines in the zsh/bash scripts; missing-key error →Run 'fduty login'. The same checks underflashdutyshowflashduty.__dump-commandsoutput differs frommainonly in the three strings that used to sayfduty.🤖 Generated with Claude Code