I am not so sure whether this has become more of a general issue or whether it is just me working a lot with OpenStack, lately. Anyways, I noticed some commands, for example the entire set of OpenStack commands and
git, offer information about their submodules using the
help subcommand, e.g.
neutron help security-group-rule-create
git help clone
This is not really nice to work with, because every time I feel uncertain about something or even encounter errors I have to
- scroll way over to the left,
- add in "help",
- press enter,
- read the help,
- press arrow up,
- scroll all the way to the left,
- delete "help",
- press enter
I know for git there are man pages available, I just wanted to add another example than OpenStack commands.
I would much rather have some key combination or even a short command which modifies the last command (the one I can recall by pressing the the arrow-up-key) and either inserts "help" as the second word or removes the second word, if it's "help".
I am using Bash, so I was thinking along the lines of using
fc and aliases, but I cannot make this work at all. I think fc's patterns are restricted to mere string replacement and cannot cope with complex things like "the second word".
The most awesome solution would be a modifier for "enter", so I can search for commands, either using the arrow-up-key, or ctrl+r and when I found the desired command I hit ctrl+enter to execute it, but before execution "help" is automagically inserted as the second word of the command. Alternatively, when I hit alt+enter to execute the desired command "help" is removed as the second word of the command before execution. Yet, I have no idea to go about this.