Accept --version as an alias for the version subcommand
Summary
-
CommandResolvertreats any leading dash as a configuration flag and routes it toRunCommand, sosquid-tentacle --versionstarted the agent instead of reporting a version. A caller that pipes the output then waits on a process that never exits — that cost a production hang in 1.4.1/1.4.2,deploy/packaging/after-install.shcarries three layers of defence about it, and the one workflow that forgot had been failing daily onmain(#481). - Route
--versionthe way help flags are already routed: checked before the dash-means-config rule, via a newCommandResolver.IsVersionFlag. -
-vis deliberately not claimed. It is already pinned as an ordinary config flag by the existingResolve_LeadingConfigFlag_DefaultsToRun_AndPassesAllArgsThroughtheory, and it means "verbose" in most CLIs — taking it would be exactly the breaking change this PR avoids. - A command set with no
VersionCommandregistered falls through to today's behaviour, so the alias is additive and can never introduce a new failure mode.
Nothing depends on the old behaviour: the only reference to squid-tentacle --version anywhere in the repo was the (already corrected) assertion in verify-linux-packages.yml.
Test plan
-
Unit: --version/--VERSIONroute toVersionCommand; the bareversionverb still routes there; unregistered-VersionCommandfalls back to run;IsVersionFlagrejects-v,-V,version, empty and null — 30/30 inCommandResolverTests -
Mutation, three directions, each fails tests: drop the route (2 fail), also claim -v(2 fail), route toRunCommandinstead ofVersionCommand(3 fail) -
Real binary: version,--versionand--VERSIONall print the version and exit immediately;-vstill starts the agent, confirming the config-flag contract is untouched -
Full Squid.Tentacle.Testssuite — remaining local failures are allStartScript_*trippingDiskSpaceCheckeron a host below its 10% free-space floor, unrelated to this change -
CI confirmation
Notes
after-install.sh keeps the bare version verb on purpose and this PR does not change it: mid-upgrade it can probe a not-yet-replaced older binary, for which only the verb has ever worked. Recorded in VersionCommand's remarks.