standardize commandline patterns
See original GitHub issueThere are many ways to create grammars for command line programs. I will enumerate a few options using git as an example:
A) no new lines ever
git push: "git push "
B) new lines sometimes (perhaps when I use “git diff” I’m always comparing branches, never using it on its own for example)
git push: "git push\n"
git pull rebase: "git pull --rebase\n"
git move: "git mv "
git diff: "git diff"
C) new lines everywhere (except where it obviously doesn’t make sense)
git push: "git push\n"
git pull rebase: "git pull --rebase\n"
git move: "git mv "
git diff: "git diff\n"
and regarding text captures a similar design decision
X) no text captures anywhere
git commit message: "git commit -m '[|]'"
git check out: "git checkout "
Y) text captures on incantations which often get followed by additional text (perhaps I almost never use any additional arguments to “git pull”)
git commit message <user.optional_text>: "git commit -m '{optional_text}'"
git pull: "git pull"
Z) text captures anywhere free text it is valid
git add <user.optional_text>: "git add {user.optional_text}"
git push force <user.optional_text>: "git push --force {user.optional_text}"
Many of these patterns are applicable to lots of commandline programs. it would be nice to understand the trade-offs of different styles and select a single style and keep everything consistent and predictable. Perhaps there are additional styles I’m not including here, feel free to add to the list.
Issue Analytics
- State:
- Created 3 years ago
- Comments:17
Top GitHub Comments
A) no new lines ever
Z) text captures everywhere