Didn't wanna get too far into defining help because it's going to require some fun editing once #60 lands, but I hope the concept with help_app_ls etc. is clear.
Try running abra help foobar and you'll get a list of available per-command help.
Closes #50
Didn't wanna get too far into defining help because it's going to require some fun editing once #60 lands, but I hope the concept with `help_app_ls` etc. is clear.
Try running `abra help foobar` and you'll get a list of available per-command help.
Never seen help <cmd>_<sub-cmd> style help so feeling a bit put off by that but I don't want to drown you in my subjectivities again ;) Any way to get this sort of help popping out for -h/--help? Looking good though! This will really bring polish to the CLI.
Never seen `help <cmd>_<sub-cmd>` style help so feeling a bit put off by that but I don't want to drown you in my subjectivities again ;) Any way to get this sort of help popping out for `-h/--help`? Looking good though! This will really bring polish to the CLI.
➕ Doesn't require user to provide a bunch of arguments, works more like git / docker
➖ Doubles the number of docopt lines
➖ Maybe risks docopt entries clobbering each other? Not sure how reliably it'll distinguish abra app cp --help from abra app <domain> --help
Use existing docopt lines, only provide help if you provide all other command args, e.g.
abra app foo_bar_com cp foo bar --help
➕ Doesn't require additional docopt lines – I think I got this working already in command_help_1 with the existing [options] def
➖ No help available until you put all the required args in, i.e. abra app cp --help → generic usage message, abra app foo_bar_com cp --help → generic usage message, abra app foo_bar_com cp src --help → generic usage message, only abra app foo_bar_com cp src dst → help for app cp
Use a docopt sub-parser for each command, and use the --help arg to show a usage message just for that command.
➕ Probably gets us the same behaviour as git and docker, although NB Docker is fussy about where --help is applied:
$ docker run alpine --help
docker: Error response from daemon: OCI runtime create failed: container_linux.go:370: starting container process caused: exec: "--help": executable file not found in $PATH: unknown.
(git is a little fussy but not as bad, git branch -a --help will fail if you're not in a git repo whereas git branch --help works everywhere)
➖ No idea how to actually do this
Switch command order and use a combination character like wp-cli, e.g.
abra [options] app:cp <domain> <src> <dst>
abra help <subcommand>
and then:
abra help app:cp
abra app:cp --help # maybe?
➕ Neat docopt
➕ Command name for help is consistent with the actual command
➖ Back to annoying systemd-style verb-first behaviour, running abra app:deploy foo_bar_com followed by abra app:logs foo_bar_com requires lots of keystrokes or advanced Bash-fu (!!:gs/deploy/logs or ^deploy^logs)
Any preferences between these?
Thanks for the review!
> Never seen help <cmd>_<sub-cmd> style help so feeling a bit put off by that...
Mm it's not ideal..
> Any way to get this sort of help popping out for -h/--help?
.. and yeah that would be best, 💯
I got stuck on `docopt` recognising commands: four ways I could think of doing that, all of which seemed mega-hairy:
1. Add a bunch of duplication to the `docopt` definition, e.g.
```
abra [options] app <domain> cp <src> <dst>
abra [options] app [<domain>] cp [<src>] [<dst>] --help
```
* ➕ Doesn't require user to provide a bunch of arguments, works more like `git` / `docker`
* ➖ Doubles the number of `docopt` lines
* ➖ Maybe risks `docopt` entries clobbering each other? Not sure how reliably it'll distinguish `abra app cp --help` from `abra app <domain> --help`
2. Use existing docopt lines, only provide help if you provide all other command args, e.g.
```
abra app foo_bar_com cp foo bar --help
```
* ➕ Doesn't require additional docopt lines – I think I got this working already in `command_help_1` with the existing `[options]` def
* ➖ No help available until you put all the required args in, i.e. `abra app cp --help` → generic usage message, `abra app foo_bar_com cp --help` → generic usage message, `abra app foo_bar_com cp src --help` → generic usage message, only `abra app foo_bar_com cp src dst` → help for `app cp`
3. Use a docopt sub-parser for each command, and use the `--help` arg to show a usage message just for that command.
* ➕ Probably gets us the same behaviour as `git` and `docker`, although NB Docker is fussy about where `--help` is applied:
```
$ docker run alpine --help
docker: Error response from daemon: OCI runtime create failed: container_linux.go:370: starting container process caused: exec: "--help": executable file not found in $PATH: unknown.
```
(`git` is a little fussy but not as bad, `git branch -a --help` will fail if you're not in a git repo whereas `git branch --help` works everywhere)
* ➖ No idea how to actually do this
4. Switch command order and use a combination character like wp-cli, e.g.
```
abra [options] app:cp <domain> <src> <dst>
abra help <subcommand>
```
and then:
```
abra help app:cp
abra app:cp --help # maybe?
```
* ➕ Neat `docopt`
* ➕ Command name for `help` is consistent with the actual command
* ➖ Back to annoying systemd-style verb-first behaviour, running `abra app:deploy foo_bar_com` followed by `abra app:logs foo_bar_com` requires lots of keystrokes or advanced Bash-fu (`!!:gs/deploy/logs` or `^deploy^logs`)
---
Any preferences between these?
What I like about our solution is that it is quite constrained by the wonders of Bash and Docopt and this feels like we're going against the grain here.
Should we just figure out how to write a man page so we can man abra and add a one-liner in the docopt definition that you can run man abra for more?
Thanks for this epic review of the options.
What I like about our solution is that it is quite constrained by the wonders of Bash and Docopt and this feels like we're going against the grain here.
Should we just figure out how to write a man page so we can `man abra` and add a one-liner in the docopt definition that you can run `man abra` for more?
What I like about our solution is that it is quite constrained by the wonders of Bash and Docopt and this feels like we're going against the grain here.
Yeah I was having the same thought, how much docopt-torturing is too much 😬
Long as my review was, I missed an obvious option tho:
abra [options] help <subcommand>...
then:
abra help app ls
Then we just combine $abra__subcommand_ options with underscores and we can even re-use my existing dubious help_app_ls convention.
Whaddya reck?
> What I like about our solution is that it is quite constrained by the wonders of Bash and Docopt and this feels like we're going against the grain here.
Yeah I was having the same thought, how much docopt-torturing is too much 😬
---
Long as my review was, I missed an obvious option tho:
`abra [options] help <subcommand>...`
then:
`abra help app ls`
Then we just combine `$abra__subcommand_` options with underscores and we can even re-use my existing dubious `help_app_ls` convention.
Whaddya reck?
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Closes #50
Didn't wanna get too far into defining help because it's going to require some fun editing once #60 lands, but I hope the concept with
help_app_lsetc. is clear.Try running
abra help foobarand you'll get a list of available per-command help.versionsubcommand 55a406573b#60 bomb dropped!
Never seen
help <cmd>_<sub-cmd>style help so feeling a bit put off by that but I don't want to drown you in my subjectivities again ;) Any way to get this sort of help popping out for-h/--help? Looking good though! This will really bring polish to the CLI.Thanks for the review!
Mm it's not ideal..
.. and yeah that would be best, 💯
I got stuck on
docoptrecognising commands: four ways I could think of doing that, all of which seemed mega-hairy:docoptdefinition, e.g.git/dockerdocoptlinesdocoptentries clobbering each other? Not sure how reliably it'll distinguishabra app cp --helpfromabra app <domain> --helpcommand_help_1with the existing[options]defabra app cp --help→ generic usage message,abra app foo_bar_com cp --help→ generic usage message,abra app foo_bar_com cp src --help→ generic usage message, onlyabra app foo_bar_com cp src dst→ help forapp cp--helparg to show a usage message just for that command.gitanddocker, although NB Docker is fussy about where--helpis applied:(
gitis a little fussy but not as bad,git branch -a --helpwill fail if you're not in a git repo whereasgit branch --helpworks everywhere)and then:
docopthelpis consistent with the actual commandabra app:deploy foo_bar_comfollowed byabra app:logs foo_bar_comrequires lots of keystrokes or advanced Bash-fu (!!:gs/deploy/logsor^deploy^logs)Any preferences between these?
Thanks for this epic review of the options.
What I like about our solution is that it is quite constrained by the wonders of Bash and Docopt and this feels like we're going against the grain here.
Should we just figure out how to write a man page so we can
man abraand add a one-liner in the docopt definition that you can runman abrafor more?Potentials:
Yeah I was having the same thought, how much docopt-torturing is too much 😬
Long as my review was, I missed an obvious option tho:
abra [options] help <subcommand>...then:
abra help app lsThen we just combine
$abra__subcommand_options with underscores and we can even re-use my existing dubioushelp_app_lsconvention.Whaddya reck?
7ec625e329to5411c85793🌈
abra [options] help <subcommand>...