Repository navigation
Show ucm, not unison, as the program name in help and messages - #6343
Open
shu-chen-dot-ca wants to merge 2 commits into
Open
shu-chen-dot-ca wants to merge 2 commits into
shu-chen-dot-ca wants to merge 2 commits into
Conversation
This branch has not been deployed
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.
Overview
ucm --helptold new users "To get started just rununison", and its usage lines saidUsage: unison ..., butunisonisn't a command people have. The release bundle starts theunison/unisonexecutable from itsucmlauncher script, and the nixpkgs package does the same withmakeWrapper, sogetProgNamealways givesunison.Now these say
ucm: the help, the usage lines (also on parse errors and subcommand help),--version, the transcript hints ("Runucm --codebase ...to do more work with it") and the codebase-not-found message ("Runucm --codebase-create <dir>to create one").Fixes #6316
Implementation approach and notes
Unison.Maingets the name from a newgetUserFacingProgName, which turnsunisonintoucmand leaves any other name as it is. All three places that calledgetProgNameuse it:main,runTranscriptsandgetCodebaseOrExit.ArgParse.parseCLIArgsrunscustomExecParserunderwithProgName progName, because optparse-applicative looks up the program name itself for theUsage:lines it prints (on--helpand on a parse error).renderUsagealready took the name as an argument.Interesting/controversial decisions
I mapped only the name
unisoninstead of always showingucm, so someone who copies or links the executable under a different name still sees that name. A side effect is that a development build run withstack exec unison -- --helpalso saysucm, since its executable has the same name.--versionnow printsucm version: .... Nothing in the repo's scripts reads that prefix:check-version.bashandmigration-test.shonly grep for the version or print the line.Test coverage
Tested by hand, through a
ucmlauncher script like the release bundle's:ucm --help,ucm run --help,ucm transcript(missing argument),ucm --bogus,ucm --versionanducm -c <dir with no codebase>all sayucm. A copy of the executable namedothernamestill saysothername. Transcripts run through thetranscriptstest executable, not thismain, so their output doesn't change../scripts/check.shpasses (tests, transcripts, formatting; migration cached), and the attestations are included.Loose ends
None.
Final checklist
.cabalfiles, make sure thepackage.yamlfiles are up-to-date instead.