Don't all work the same. The argument is only actually taken if it's attached to the flag directly. In the latter two forms, no backup is made.
GNU mktemp is similarly annoying, but different, with the --tmpdir flag.
-pDIR, --tmpdir=DIR, -p DIR, --tmpdir NEXTARG
Only the last one is different. If you use --tmpdir literally without attaching an argument to it, it defaults to $TMPDIR, otherwise it takes in DIR.
This is inconsistent and unpredictable. A flag should either take an argument or not.
I also dislike Python's argparse variable-length nargs behavior for similar reasons. Even with an integer nargs, it makes for an ugly command line, but with variable-length ones it just gets hideous, and can make it impossible to pass an argument beginning with a hyphen to a flag.
-lN, --line-length=N, -l N, --line-length N
All work the same, set line length to N.
-iSUFFIX --in-place=SUFFIX, -i NEXTARG --in-place NEXTARG
Don't all work the same. The argument is only actually taken if it's attached to the flag directly. In the latter two forms, no backup is made.
GNU mktemp is similarly annoying, but different, with the --tmpdir flag.
-pDIR, --tmpdir=DIR, -p DIR, --tmpdir NEXTARG
Only the last one is different. If you use --tmpdir literally without attaching an argument to it, it defaults to $TMPDIR, otherwise it takes in DIR.
This is inconsistent and unpredictable. A flag should either take an argument or not.
I also dislike Python's argparse variable-length nargs behavior for similar reasons. Even with an integer nargs, it makes for an ugly command line, but with variable-length ones it just gets hideous, and can make it impossible to pass an argument beginning with a hyphen to a flag.