Repository navigation
fix(argv): -h/--help intercept on cmd_peers/disconnect/quit/invite/version/ping/tests (round 2) - #251
Conversation
…rsion/ping/tests continuum-b741's verb-fuzz round 2 against canary HEAD found 4 regressions / wart that #237's sweep missed: - airc peers --help: ignored (no intercept) - airc disconnect / quit --help: EXECUTED the disconnect (their monitor died) - airc invite (no-args dispatch): --help fell through to invite logic - airc version (no-args dispatch): same - airc ping --help: exited 1 not 0 - airc tests --help: exited 2 inconsistently ## Fix Added -h/--help intercepts to: cmd_peers, cmd_disconnect, cmd_invite, cmd_version, cmd_ping, _doctor_run_tests. Plus dispatch fixes in airc top-level: invite/version/disconnect/quit case branches now `shift; cmd_X "$@"` so flags reach the function. Previously they called cmd_X with no args, so --help on the cmdline never reached the function-level intercept. Verification: tabs 19/0; manual exercise of all 7 --help paths.
There was a problem hiding this comment.
Pull request overview
Fixes missed -h/--help interception paths for several airc verbs so --help doesn’t fall through into real execution (including destructive paths), and ensures top-level dispatch forwards args to the underlying command functions.
Changes:
- Add
-h/--helpintercept blocks tocmd_version,cmd_disconnect,cmd_ping,cmd_invite,cmd_peers, and_doctor_run_tests. - Update
airctop-level dispatch toshiftand pass"$@"forinvite/share/join-string,version/--version/-v, anddisconnect/quit/leave/unbind. - Provide consistent
Usage:output for these verbs when invoked with help flags.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
lib/airc_bash/cmd_update.sh |
Adds -h/--help intercept to cmd_version. |
lib/airc_bash/cmd_teardown.sh |
Adds -h/--help intercept to cmd_disconnect. |
lib/airc_bash/cmd_send.sh |
Adds -h/--help intercept to cmd_ping. |
lib/airc_bash/cmd_rooms.sh |
Adds -h/--help intercepts to cmd_invite and cmd_peers. |
lib/airc_bash/cmd_doctor.sh |
Adds -h/--help intercept to _doctor_run_tests. |
airc |
Fixes dispatch to forward args into cmd_invite, cmd_version, and cmd_disconnect. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| echo " airc disconnect / quit leave the mesh: kill processes + clear host pairing" | ||
| echo " (identity, peers, message history preserved)" |
There was a problem hiding this comment.
The help text only mentions disconnect / quit, but the top-level dispatch also routes leave and unbind to cmd_disconnect. Update the Usage line to include all supported aliases (or use a generic form like airc disconnect|quit|leave|unbind) so airc leave --help / airc unbind --help aren't misleading.
| echo " airc disconnect / quit leave the mesh: kill processes + clear host pairing" | |
| echo " (identity, peers, message history preserved)" | |
| echo " airc disconnect|quit|leave|unbind leave the mesh: kill processes + clear host pairing" | |
| echo " (identity, peers, message history preserved)" |
| echo " airc ping @peer liveness probe (default 10s timeout)" | ||
| echo " airc ping @peer <timeout> override timeout (positive integer seconds)" | ||
| return 0 ;; |
There was a problem hiding this comment.
The Usage text says the timeout is a “positive integer seconds”, but the current validation accepts 0 (it only rejects non-digits/empty). Either tighten the check to reject 0, or adjust the help wording/error message to match the actual accepted range.
continuum-b741 verb-fuzz round 2 found 6 verbs missed by #237's sweep — including 'airc disconnect/quit --help' which actually EXECUTED. Fixes both function-level intercepts AND the no-args dispatch branches in airc top-level.