Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/help.py @ 41020:e8e2a7656e83
help: hide default value for default-off flags
If we no longer show the "[no-]" for default-off flags, it also seems
unnecessary to show the "default: off" for them, since that's quite
clearly the default. It's extra confusing for action flags like `hg
bookmarks --delete`.
Differential Revision: https://phab.mercurial-scm.org/D5455
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Wed, 19 Dec 2018 09:33:42 -0800 |
parents | fcc0a7ac9ebd |
children | 9afe128f7727 |
comparison
equal
deleted
inserted
replaced
41019:fcc0a7ac9ebd | 41020:e8e2a7656e83 |
---|---|
163 if default is True: | 163 if default is True: |
164 lo = '--[no-]' + longopt | 164 lo = '--[no-]' + longopt |
165 | 165 |
166 if isinstance(default, fancyopts.customopt): | 166 if isinstance(default, fancyopts.customopt): |
167 default = default.getdefaultvalue() | 167 default = default.getdefaultvalue() |
168 if (default and not callable(default)) or default is False: | 168 if default and not callable(default): |
169 # default is of unknown type, and in Python 2 we abused | 169 # default is of unknown type, and in Python 2 we abused |
170 # the %s-shows-repr property to handle integers etc. To | 170 # the %s-shows-repr property to handle integers etc. To |
171 # match that behavior on Python 3, we do str(default) and | 171 # match that behavior on Python 3, we do str(default) and |
172 # then convert it to bytes. | 172 # then convert it to bytes. |
173 defaultstr = pycompat.bytestr(default) | 173 defaultstr = pycompat.bytestr(default) |
174 if isinstance(default, bool): | 174 if default is True: |
175 defaultstr = _("on") if default else _("off") | 175 defaultstr = _("on") |
176 desc += _(" (default: %s)") % defaultstr | 176 desc += _(" (default: %s)") % defaultstr |
177 | 177 |
178 if isinstance(default, list): | 178 if isinstance(default, list): |
179 lo += " %s [+]" % optlabel | 179 lo += " %s [+]" % optlabel |
180 multioccur = True | 180 multioccur = True |