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

Martijn Pieters mj at zopatista.com
Tue Jun 21 16:17:05 UTC 2016


# 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")
 
         COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$opts' -- "$cur"))
         _hg_fix_wordlist


More information about the Mercurial-devel mailing list