Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/help.py @ 40968:f6187e60f792
help: present boolean arguments as "--[no-]foo"
This should make it much more discoverable (we document it in `hg help
flags`, but most users don't think to look there).
Note that flags that default to None (and not False) will not get this
new presentation. We can change the defaults to False later for flags
where it makes sense (probably almost all boolean flags).
Differential Revision: https://phab.mercurial-scm.org/D5432
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 14 Dec 2018 13:44:46 -0800 |
parents | 8604f130eb43 |
children | fcc0a7ac9ebd |
comparison
equal
deleted
inserted
replaced
40967:8604f130eb43 | 40968:f6187e60f792 |
---|---|
158 | 158 |
159 so = '' | 159 so = '' |
160 if shortopt: | 160 if shortopt: |
161 so = '-' + shortopt | 161 so = '-' + shortopt |
162 lo = '--' + longopt | 162 lo = '--' + longopt |
163 if isinstance(default, bool): | |
164 lo = '--[no-]' + longopt | |
163 | 165 |
164 if isinstance(default, fancyopts.customopt): | 166 if isinstance(default, fancyopts.customopt): |
165 default = default.getdefaultvalue() | 167 default = default.getdefaultvalue() |
166 if (default and not callable(default)) or default is False: | 168 if (default and not callable(default)) or default is False: |
167 # default is of unknown type, and in Python 2 we abused | 169 # default is of unknown type, and in Python 2 we abused |