diff options
author | NRK <nrk@disroot.org> | 2022-09-28 18:15:09 +0200 |
---|---|---|
committer | NRK <nrk@disroot.org> | 2022-09-28 18:15:09 +0200 |
commit | 85fffbb277418dfc5e03fc8e01335553333d8049 (patch) | |
tree | 5422ccc941f4b40f49f3d83c5391058106bcd3b1 /config.def.h | |
parent | daee34477a87f7eb97aa537577a48ddcf5a7d30b (diff) | |
download | nsxiv-85fffbb277418dfc5e03fc8e01335553333d8049.tar.zst |
improve error message on bad cli argument (#371)
currently the error messages have the shortopt hardcoded in them, even
when the user actually entered a longopt:
$ ./nsxiv --framerate v
nsxiv: Invalid argument for option -A: v
and as far as I see, there's no way to *reliably* tell weather we're
processing a longopt or a shortopt. perhaps we can do some shenanigangs
with `optind` but that seems finicky at best.
and it seems like other coreutils which support longopt has similar issues:
$ xargs --max-procs=z
xargs: invalid number "z" for -P option
utils like `grep` and `head` seems to work-around it by not mentioning the flag:
$ head --lines=z
head: invalid number of lines: ‘z’
$ grep --max-count=l
grep: invalid max count
this patch does the same thing as `grep/head` and omits the flag from
the error message.
Closes: https://codeberg.org/nsxiv/nsxiv/issues/368
Reviewed-on: https://codeberg.org/nsxiv/nsxiv/pulls/371
Reviewed-by: Berke Kocaoğlu <berke.kocaoglu@metu.edu.tr>
Diffstat (limited to 'config.def.h')
0 files changed, 0 insertions, 0 deletions