[PATCH] bashcompletion: show available command-line switches for aliases

Anton Shestakov engored at ya.ru
Tue Jun 21 12:36:55 EDT 2016


22.06.2016, 00:18, "Martijn Pieters" <mj at zopatista.com>:
>  # HG changeset patch
>  # User Martijn Pieters <mjpieters at fb.com>
>  # Date 1466525751 -3600
>  # Tue Jun 21 17:15:51 2016 +0100
>  # Node ID 5931a36ea0d7bbc14d6e68eb69b4fc81b2e00e97
>  # Parent fcaf20175b1b05aa753e1b9f65f10d35a86224df
>  bashcompletion: show available command-line switches for aliases
>
>  When auto-completing hg commands, aliases are listed, but not the available
>  switches for an alias, because `HGPLAIN=1` filters these out. Add a
>  `HGPLAINEXCEPT=alias` exception to resolve this.
>
>  We make heavy use of aliases that drive hg log with custom revsets, sorting and
>  the -G switch, but want our users to be able to auto-complete any additional
>  command-line switches.
>
>  diff --git a/contrib/bash_completion b/contrib/bash_completion
>  --- a/contrib/bash_completion
>  +++ b/contrib/bash_completion
>  @@ -184,7 +184,7 @@
>               return
>           fi
>
>  - opts=$(_hg_cmd debugcomplete --options "$cmd")
>  + opts=$(HGPLAINEXCEPT=alias _hg_cmd debugcomplete --options "$cmd")

Looks good, since another instance of "_hg_cmd debugcomplete" already has HGPLAINEXCEPT=alias.

JFYI, I've tried this with my "crecord = !$HG commit --interactive --config ui.interface=curses $@" alias and since `hg debugcomplete --options crecord` only lists global options, it still couldn't complete --amend or --secret...


More information about the Mercurial-devel mailing list