git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/2] complete: zsh: use zsh completion for the main cmd

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Apr 27, 2013, 21:53 UTC
Message-ID
<CAMP44s1dEydqNWH+dFTCj13dfOCVym9XHCYnx12E5hosYNF9Rg@mail.gmail.com>
In-Reply-To
<7vtxmrsleq.fsf@alter.siamese.dyndns.org>
On Sat, Apr 27, 2013 at 4:39 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 30 quoted lines
> Felipe Contreras <felipe.contreras@gmail.com> writes:
>
>> +__git_zsh_cmd_common ()
>> +{
>> +     local -a list
>> +     list=(
>> +     add:'add file contents to the index'
>> +     bisect:'find by binary search the change that introduced a bug'
>> +     branch:'list, create, or delete branches'
>> +     checkout:'checkout a branch or paths to the working tree'
>> +     clone:'clone a repository into a new directory'
>> +     commit:'record changes to the repository'
>> +     diff:'show changes between commits, commit and working tree, etc'
>> +     fetch:'download objects and refs from another repository'
>> +     grep:'print lines matching a pattern'
>> +     init:'create an empty Git repository or reinitialize an existing one'
>> +     log:'show commit logs'
>> +     merge:'join two or more development histories together'
>> +     mv:'move or rename a file, a directory, or a symlink'
>> +     pull:'fetch from and merge with another repository or a local branch'
>> +     push:'update remote refs along with associated objects'
>> +     rebase:'forward-port local commits to the updated upstream head'
>> +     reset:'reset current HEAD to the specified state'
>> +     rm:'remove files from the working tree and from the index'
>> +     show:'show various types of objects'
>> +     status:'show the working tree status'
>> +     tag:'create, list, delete or verify a tag object signed with GPG')
>
> Maintaining this list feels somewhat painful.  Isn't this something
> we can help by tweaking "git help"?

Yes, that's the way Bazaar does it (bzr shell-complete), but for now this does the trick.

Also, I've been carrying around the patches from Stephen Boyd that add --dump-raw-long-options. I think it would be better if somehow 'git help' learned how to throw this output for both commands and arguments, and then use the first part for bash, or specify bash format somehow. Of course, we would need to add support for descriptions in the option parser.

It's the big world-domination plan for completions, but I haven't had time to work on that.

Cheers.
-- 
Felipe Contreras
Previous: Junio C Hamano
Message 5 of 5 in “completion: zsh: nice stuff”
  1. 0/2 completion: zsh: nice stuffFelipe Contreras, Apr 27, 2013
  2. 1/2 complete: zsh: trivial simplificationFelipe Contreras, Apr 27, 2013
  3. 2/2 complete: zsh: use zsh completion for the main cmdFelipe Contreras, Apr 27, 2013
  4. Junio C HamanoApr 27, 2013
  5. Felipe ContrerasApr 27, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.