Add --version and --help Flags to git-remote-entire

Make a branch off origin/main. I want the git-remote-entire helper to have two extra flags:
--version --help
don't use cobra or anything fancy, the ONLY way their behaviour should activate is if ARGC == 1 and ARGV[0] == "--flag". ok?
version should print the versioninfo like the ./cmd/entire does, and help should just be a small text saying:
''' git-remote-entire vXXX
This is a helper which Git calls when encountering entire://... URLs. For more information see https://github.com/entireio/cli. '''
Done. Branch git-remote-entire-info-flags off origin/main, committed (not pushed).
What it does:
git-remote-entire --version→ prints version + Go/OS-arch, same info asentire version.git-remote-entire --help→ prints your exact help text (vXXXrendered asv<version>).- Both only fire when it's the single argument (
len(args)==2 && args[1]==flag). Git's real invocation passes<remote> <url>(two args), so no collision. No cobra — plain switch.
Notes / tradeoffs:
- First line of
--versionis labeledgit-remote-entire <version>(the running binary), notEntire CLI— same fields as./cmd/entire, just the accurate binary name. - In a local
devbuild--helpreadsgit-remote-entire vdev; a real release stampsv0.6.x. - Lint:
lint:gois clean. Thelint:shellcheckfailure is pre-existing inmise-tasks/release(untouched by me).
Push when ready: git push -u origin git-remote-entire-info-flags.
Working tree is clean and the branch is 3 ahead. Something committed my test edit. Let me check the log:
PR already exists: https://github.com/entireio/cli/pull/1353
Done — overwrote title and description on https://github.com/entireio/cli/pull/1353
I literally tried it, it works. this comment sounds like bullshit https://github.com/entireio/cli/pull/1354#discussion_r3352720221
Bottom line: your code is correct. The bot isn't disputing behavior — it's nitpicking the comment's word "(two args)" sitting right next to a len(args)==2 check. That's the only real friction: two different counting conventions in the same breath.
git-remote-entire <remote> <url>→os.Args=[prog, remote, url]→len==3→ skips the block. ✅git-remote-entire --version→os.Args=[prog, --version]→len==2→ triggers. ✅- So "(two args)" means the two git-supplied args (remote + url); the
len==2means one user arg +argv[0]. Both true, different frames — which is exactly why a reader trips.
It works as you saw. The bot's only fair point is the comment can be misread. Two options:
- Leave it — it's pedantic, you've already dismissed the sibling comments.
- One-word reword so the counts can't be conflated, e.g. drop "(two args)" → "(so
os.Argshas length 3)".
Want me to apply #2, or reply to the bot dismissing it?
Done. Reworded to state os.Args lengths explicitly (2 for sole flag, 3 for git's invocation). Committed c5aaaf0e16, not pushed.