Allow renaming the launcher without recompilation#195
Open
jdevera wants to merge 5 commits into
Open
Conversation
Resolve os.Args[0] through symlinks to get the real binary name at runtime. Symlinks behave as aliases (same identity), while copies or hard links produce a distinct app name and config directory. The display long name can be overridden via the app_long_name config key, falling back to the compiled-in default when unset.
…entity The test-cmd-context test previously copied the cl binary to clcopy and checked that CL_FULL_COMMAND_NAME reflected the new name. With runtime app name resolution, a copied binary is now a separate instance with its own env var prefix (CLCOPY_ instead of CL_), so the dropin script's hardcoded $CL_FULL_COMMAND_NAME comes back empty. The copy-based FULL_COMMAND_NAME behavior is already covered by the new test-runtime-name integration test. This test now checks FULL_COMMAND_NAME with the original cl binary, which still validates that the env var is correctly set with group and without group.
This was referenced May 17, 2026
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
Right now, if you want to run command-launcher under a different name (say
vhtinstead ofcdt), you have to recompile it. This PR makes it so you can just copy or rename the binary and it picks up the new name automatically.This means you can build a single binary and use it for multiple launchers just by copying it. More importantly, anyone can grab the official release from the GitHub releases page and use it directly for their own launcher. No need to build from source at all.
How it works:
app_long_name, so you don't need to recompile for that eitherapp_long_nameisn't set, it falls back to the compiled-in default, so nothing changes for existing usersExample workflow:
Note on env var prefix: since a copied binary is a new identity, its env var prefix changes too (e.g.
MYAPP_instead ofCDT_). This also means dropin scripts that hardcode a specific prefix won't see the right vars under a different binary name. TheCOLA_prefixed vars (already exported by the launcher) work regardless of binary name.Changes
main.go: resolve the binary path at startup to derive the app namecmd/root.go: load config before creating the root command so we can readapp_long_nameinternal/config/settings.go: addapp_long_nameas a string config keymain_test.go: unit tests for the name resolution logictest/integration/test-runtime-name.sh: integration tests for binary name, symlink, copy, and config overridetest/integration/test-cmd-context.sh: updated FULL_COMMAND_NAME test — the old test copied the binary and relied on the copy sharing the original's env var prefix, which is no longer the case. The copy-based name behavior is now covered by test-runtime-name.sh instead.Tests