Commit fbed2ba
authored
fix(cli): match apprise help and option errors (#62)
## What changed
- Render full Apprise-style CLI help for `--help` and `-h`.
- Suppress Go's default `flag` usage dump for unknown options.
- Emit Python Apprise-style unknown-option errors for unsupported flags.
- Add parity coverage for no-args, help, bad-option, and mixed
parse-error CLI workflows.
- Add built-binary E2E coverage to validate real process exit codes and
stdout/stderr wiring.
- Add regression coverage that older accepted flag forms still parse,
including legacy single-dash long aliases.
- Update the parse-error regression to compare Go against installed
Python Apprise for the exact same arguments instead of using
hand-written expected output.
## Why
The CLI request-spec parity tests covered notification behavior, but not
CLI help and parser output. As a result, `apprise-go` diverged from
Python Apprise: `--help` showed only the short usage banner, and invalid
flags dumped Go's full flag table.
The parser change should not break existing `apprise-go` users who were
relying on accepted Go flag spellings, so the PR also locks in
compatibility for those older forms. For mixed parser failures, the test
now uses the installed Python Apprise CLI as the source of truth.
## Validation
- Built and manually ran `/tmp/apprise-cli-parity` from `./cmd/apprise`:
- `--version`
- no arguments
- `--help`
- `--blah`
- legacy single-dash long aliases such as `-body`, `-title`,
`-notification-type`, `-input-format`, and `-version`
- `go test ./internal/cli -run TestCLIParseErrorsMatchPythonApprise
-count=1`
- `go test ./internal/cli`
- `go test ./...`
- Limetech CodeRabbit final check: `unresolved_coderabbit_threads 0`
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Help flag now displays the full, user-friendly help text.
* **Bug Fixes**
* Unknown options produce a clear custom error message and proper exit
code; parse errors are reported consistently.
* **Tests**
* Added cross-implementation tests validating help, unknown-option
behavior, legacy flag parsing, and parse-error handling.
* **Chores**
* Updated internal run/notes document to reflect the new CLI parity run.
<!-- review_stack_entry_start -->
[](https://app.coderabbit.ai/change-stack/unraid/apprise-go/pull/62?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)
<!-- review_stack_entry_end -->
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
#591 parent 0230c9d commit fbed2ba
3 files changed
Lines changed: 375 additions & 38 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
| 21 | + | |
| 22 | + | |
26 | 23 | | |
27 | 24 | | |
28 | 25 | | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
52 | 29 | | |
53 | 30 | | |
54 | 31 | | |
55 | 32 | | |
56 | 33 | | |
57 | 34 | | |
58 | | - | |
59 | | - | |
| 35 | + | |
| 36 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
21 | 96 | | |
22 | 97 | | |
23 | 98 | | |
| |||
75 | 150 | | |
76 | 151 | | |
77 | 152 | | |
78 | | - | |
| 153 | + | |
| 154 | + | |
79 | 155 | | |
80 | 156 | | |
81 | 157 | | |
| |||
127 | 203 | | |
128 | 204 | | |
129 | 205 | | |
130 | | - | |
| 206 | + | |
131 | 207 | | |
132 | 208 | | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
133 | 213 | | |
134 | | - | |
135 | 214 | | |
136 | 215 | | |
137 | 216 | | |
138 | 217 | | |
139 | | - | |
| 218 | + | |
140 | 219 | | |
141 | 220 | | |
142 | 221 | | |
| |||
253 | 332 | | |
254 | 333 | | |
255 | 334 | | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
256 | 344 | | |
257 | 345 | | |
258 | 346 | | |
| |||
275 | 363 | | |
276 | 364 | | |
277 | 365 | | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
278 | 387 | | |
279 | 388 | | |
280 | 389 | | |
| |||
0 commit comments