3 ms·
Oh, and I just remembered where this always burns me. It's cases like this: ./myprogram --config=~/.config/myprogram Of course, many flags parsers are awa
by jrockway 2y ago
Oh, and I just remembered where this always burns me. It's cases like this:
./myprogram --config=~/.config/myprogram
Of course, many flags parsers are aware of this, or at least accidentally aware of this, because you can write it in a form that your shell will expand.
./myprogram --config ~/.config/myprogram
For some reason, my muscle memory requires me to type the =. I don't know why. It's probably a habit I picked up from a former employer's flag parsing library. I also always use --underscores_like_this instead of --hyphens-like-normal-people for the same reason. Sigh!
- jasomill 2y agoI have the same habit. The lack of tilde expansion after the equals sign has helped a bit in breaking this habit, however. Interestingly, bash does do tilde expansion, but not tab completion, after the first equal sign, and after every colon, in variable-style arguments: $ /bin/echo --foo=~ bar=~:~root --foo=~ bar=/home/jtm:/root While tab completion can be fixed in appropriate contexts using custom completion functions (e.g., [1]), AFAIK there's no way to customize tilde expansion contexts (other than the fact that tilde expanding variable-style arguments is disabled in POSIX mode). [1] https://github.com/scop/bash-completion/blob/8a8880db78e9b04fb3d66681028af701701f93f2/completions/dd#L10 https://github.com/scop/bash-completion/blob/8a8880db78e9b04...