Commit 22fb72b
committed
fix(cli): preserve concrete parse errors
Purpose of the change:
- Address CodeRabbit feedback on the CLI unknown-option formatter.
- Ensure concrete parser errors are not replaced by later unknown-option text.
How behavior was before:
- Any parse failure could trigger an argument scan for unknown options.
- A command like -R not-an-int --blah could report --blah instead of the invalid integer value.
Why that was a problem:
- It hid the real parse failure and made CLI diagnostics less accurate.
- The Apprise-style unknown-option formatter was broader than the condition it was meant to handle.
What the new change accomplishes:
- Limits Apprise-style unknown-option formatting to actual unknown-flag parse errors.
- Leaves other parse failures on the standard parser error path.
- Adds regression coverage for invalid integer parsing followed by an unknown option.
How it works:
- Adds a focused parse-error classifier for the Go flag unknown-option error prefix.
- Keeps the existing unknown-option scan only inside that classifier branch.1 parent 957caa2 commit 22fb72b
2 files changed
Lines changed: 26 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
209 | | - | |
210 | | - | |
211 | | - | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
212 | 214 | | |
213 | 215 | | |
214 | 216 | | |
| |||
341 | 343 | | |
342 | 344 | | |
343 | 345 | | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
344 | 350 | | |
345 | 351 | | |
346 | 352 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
163 | 180 | | |
164 | 181 | | |
165 | 182 | | |
| |||
0 commit comments