[ANNOUNCE] hg "shell" extension

Mark Williamson mark.williamson at cl.cam.ac.uk
Tue Feb 5 20:43:09 CST 2008


Replying to my own original announcement, quoted below.

Here's a new version of the patch for anyone who's interested.  Same 
disclaimers about development code, use at own risk, etc ;-)

This version features massively improved tab completion.  It's now possible to 
tab complete on:

- command names
- help arguments
- global options
- command options

The completion understands which options require an argument and will not 
start suggesting new options until you give them one.  It also understands 
that some options / commands require specific argument types: when a file arg 
is expected it will eagerly suggest filename completions, output types for 
the "hg archive" command are supported, etc.

I've drawn some ideas as to what to implement from the existing, very fine, 
bash_completion and zsh_completion scripts - as well as adding a few ideas of 
my own ;-)

Cheers,
Mark

On Tuesday 05 February 2008, Mark Williamson wrote:
> Hi all,
>
> I'm not aware of anything like this having been done before but maybe I
> just missed it.  For some reason I've decided it'd be "fun" to dive into
> playing with Python's readline interface and hacked up a prototype
> interactive Hg shell.
>
> The attached patch is a snapshot of how far I've gotten.  It applies with
> -p0 and adds a file "shell.py" to the hgext directory.  There are no other
> changes to the hg source.
>
> The "shell" extension implements an interactive commandline for hg,
> supporting editting, history and tab completion on command names, command
> options and global opions.  It should work on Unix systems, but I believe
> not on Windows (which lacks a Python readline module, apparently).
>
> The tab completion isn't yet as intelligent as it could be, since it
> doesn't understand which options should also have arguments and it's not
> able to complete filenames or revision IDs.  I'll hope to add these
> features in a future release
>
> My usual disclaimer: this hasn't done anything nasty to me, but remember
> it's pre-release code.  Thought some here might enjoy taking a look /
> playing around with it.
>
> Cheers,
> Mark



-- 
Push Me Pull You - Distributed SCM tool (http://www.cl.cam.ac.uk/~maw48/pmpu/)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hgshell-ext.patch
Type: all/allfiles
Size: 8808 bytes
Desc: not available
Url : http://selenic.com/pipermail/mercurial/attachments/20080206/99327151/attachment.bin 


More information about the Mercurial mailing list