[IPython-user] Specifying argv as a list
vivainio at gmail.com
Thu Jun 22 02:08:31 CDT 2006
On 6/22/06, Asheesh Laroia <asheesh at asheesh.org> wrote:
> Is there a way for me to type out arguments to regular UNIX programs as a
> list rather than an implicit list separated by " "?
> The best user interface I can imagine to this is that when you type "!ls"
> and press space, the input transforms before your eyes to:
> ! ["ls", "
> I might then press the hyphen key, the 'l' key, and then enter, and the
> command-line would autocomplete that to:
> ! ["ls", "-l"])
> and then show me the output.
I will implement custom completer hooks soon, then you can implement a
hook that does the thing in concert with input prefilter hook (apart
from the fact that you'll press tab instead of space, of course).
You'd probably want to use !! as the prefix for argv-as-list version,
because it's almost obsolete these days.
> A basic version would simply allow me to manually type:
> lout(['ls', '-l'])
> and show me the result as I'd expect.
This is of course trivial.
> I like showing argv to the user as a list because that's precisely what it
> is. This also allows more natural variable insertion and Python
> integration. For example:
> ! ['rm', RMARG, '''Some "loser"'s file''']
variable insertion is ok already ($RMARG is brief and intuitive) but
using the python string notation is a valid use case.
Let's get back to this once I get the custom completer hook in place,
nothing is going to happen this weekend (apart from mobile mail
reading) because I'll be away.
On a related note, happy midsummer night to those who celebrate such a
Ville Vainio - vivainio.googlepages.com
vainio.blogspot.com - g[mail | talk]='vivainio'
More information about the IPython-user