Commit 49950ab
committed
nl: accept negative -v and -i values given as separate arguments
GNU nl accepts a negative starting line number or increment passed as a
separate argument, such as `nl -v -5` or `nl -i -2`. uutils only accepted
the attached forms (`-v-5`, `--starting-line-number=-5`); the space-
separated form failed with "unexpected argument '-5' found" because clap
treated the leading-hyphen token as an unknown flag.
Set allow_hyphen_values on the -v and -i arguments so the negative value
is consumed as the option value, matching GNU. The value parser was
already i64, so negative numbers were always intended.
Add tests covering the space-separated form for both options.1 parent d41c56b commit 49950ab
2 files changed
Lines changed: 23 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
329 | 329 | | |
330 | 330 | | |
331 | 331 | | |
| 332 | + | |
332 | 333 | | |
333 | 334 | | |
334 | 335 | | |
| |||
368 | 369 | | |
369 | 370 | | |
370 | 371 | | |
| 372 | + | |
371 | 373 | | |
372 | 374 | | |
373 | 375 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
254 | 254 | | |
255 | 255 | | |
256 | 256 | | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
257 | 268 | | |
258 | 269 | | |
259 | 270 | | |
| |||
298 | 309 | | |
299 | 310 | | |
300 | 311 | | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
301 | 322 | | |
302 | 323 | | |
303 | 324 | | |
| |||
0 commit comments