Zbyszek Szmek <zbys...@in.waw.pl> added the comment:

zsh completion is much more powerful. E.g. for git<SP>log<SP><TAB> I see:
completing head
<list-of-heads>
completing commit object name
completing cached file
abspath.c                   git-lost-found.sh           README                  
  
aclocal.m4                  git-merge-octopus.sh        reflog-walk.c           
  
...

git<SP><TAB>
completing alias
diffab                    -- alias for 'diff --src-prefix=a/ --dst-prefix=b/'
lol                       -- alias for 'log --graph --decorate --pretty=oneline 
--abbrev-commit'
lola                      -- alias for 'log --graph --decorate --pretty=oneline 
--abbrev-commit --all'
mergeu                    -- alias for 'merge --ff-only @{u}'
completing main porcelain command
add                       -- add file contents to index
am                        -- apply patches from a mailbox
...

The header parts ('completing commit object name', 'completing head',
'completing cached file') are in bold red. So different completions
types are supported, and some help is provided, and completions
are split in groups.

Completion for options knows which short/long options go together:
git log -<TAB> prints:
...
--oneline                                          -- shorthand for 
--pretty=oneline --abbrev-commit    
--ours                    -2                       -- diff against "our branch" 
version                 
--parents                                          -- display parents of commit 
                        
--patch                   -u           -p          -- generate diff in patch 
format                     
...

fish ("a friendly interactive shell" which I don't use but
which has some very cool features) prints something like
a\%b                                                                            
             (Branch)
abspath.c                                                                      
(C source code, 4.2kB)
abspath.o                                                                       
  (Object code, 13kB)
aclocal.m4                                                                      
    (M4 macro, 1.4kB)
adres                                                                           
          (File, 23B)
advice.c                                                                       
(C source code, 2.4kB)
advice.h                                                                        
     (C header, 555B)

I think that for --help-options to be usefull, it should list more information
than is needed just for bash completion. At least:
- options, with long and short options specified together
- short help for options (or maybe all of the help)
- option groups if such are used
- metavar names

This last part could be used by the completion script to customize completions
for a specific program. E.g. the completion script could know that FILE means a 
file,
and HOST means a host name.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue4256>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to