Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [patch] _hg: completion for 'hg bookmarks'



Christoph Mathys wrote on Thu, Sep 24, 2015 at 16:23:51 +0200:
> Hi there
> 
> Below is a patch to add completion support for the "hg bookmarks" command.
> 

Thanks!  A few comments:

1. The function should be defined further up in the file (_hg_cmd_* are
defined alphabetically).

2. --rev and --message need to become --rev= and --message= to allow
both '--rev ARG' and '--rev=ARG' (which both work).

3. Why do you have a leading '-' on the first and last line?  Is it
intentional?

4. How should positional arguments (i.e., 'hg bookmarks <TAB>') be
completed?  They are currently completed as files; presumably they
should be completed as _hg_bookmarks_internal?

5. Your mailer munged whitespace in the patch.  You should be able to
avoid this by sending the patch as an attachment named *.txt.

Thanks,

Daniel

> thg,
> Christoph
> 
> PS Please CC on reply, I'm not subscribed to the list.
> 
> diff --git a/Completion/Unix/Command/_hg b/Completion/Unix/Command/_hg
> index e7c21b9..edd7f0d 100644
> --- a/Completion/Unix/Command/_hg
> +++ b/Completion/Unix/Command/_hg
> @@ -962,4 +962,14 @@ _hg_cmd_strip() {
>    ':revision:_hg_tags'
>  }
> 
> +_hg_cmd_bookmarks() {
> +  _arguments -s -w : $_hg_global_opts \
> +  - '(--force -f)'{-f,--force}'[force]' \
> +    '(--rev -r)'{-r+,--rev}'[set bookmark at revision]:revision:_hg_tags' \
> +    '(--delete -d)'{-d,--delete}'[delete a given bookmark]' \
> +    '(--rename -m)'{-m+,--rename}'[rename given
> bookmark]:bookmark:_hg_bookmarks_internal' \
> +    ':bookmark:_hg_bookmarks_internal' \
> +  - '(--inactive -i)'{-i,--inactive}'[mark a bookmark inactive]'
> +}
> +
>  _hg "$@"



Messages sorted by: Reverse Date, Date, Thread, Author