Example makes it clearer:
$ with git
git> add .
git> commit -a -m "Commited"
This reminds me a lot of a common Common Lisp macro idiom. If there’s some thing that’s likely to be used in a block of code in a way which would cause repetition (a socket, an object, etc.), one idiom is to provide a with-xxx macro that makes one specific instance of the thing in question implicit/default in that context. In this case, the command name.
To illustrate what I mean with some invented Lisp pseudocode for your example, a convenience macro like this would be normal to find in a Lisp package:
(git-commit -a -m "Committed")
(commit -a -m "Committed")
Really like this idea!
Will have to watch myself - I can imagine accidentally staying in a “sudo>” shell :/
Does eat history though (commands run in sub shell are not captured)
Im no bash expert but I think it could append to the bash history file or at least call a command to. That might be an easy addition.
the author says it’s on the todo list
you mean like ‘su’?
Yeah you’re absolutely right :) - although I tend to avoid su for the exact same reason
or sudo -s
Heh, I made the same thing in January: