diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2018-08-10 03:15:33 +0200 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2018-08-10 04:57:13 +0200 |
| commit | 8efc358b6468834c7913cdf213e4aba05aeb14f7 (patch) | |
| tree | cb848c96d8dc5747c00f45c665ac3be0ddec737f | |
| parent | 6726fa641e04f6c22d0d38220f6ea6999561e8ec (diff) | |
menuconfig: Omit tristate value hint for int/string/hex defaults
Previously, defaults for string/int/hex symbols showed up as e.g.
'17 (value: "n")' in the symbol information, which looks confusing.
Only display the hint for bool/tristate symbols to fix it.
For "non-literal" symbols, _expr_str() still takes care of showing the
value (e.g. 'FOO(="bar")').
| -rwxr-xr-x | menuconfig.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/menuconfig.py b/menuconfig.py index 2ef3bd7..dccac38 100755 --- a/menuconfig.py +++ b/menuconfig.py @@ -90,7 +90,7 @@ import re import textwrap from kconfiglib import Symbol, Choice, MENU, COMMENT, MenuNode, \ - BOOL, STRING, INT, HEX, UNKNOWN, \ + BOOL, TRISTATE, STRING, INT, HEX, UNKNOWN, \ AND, OR, NOT, \ expr_str, expr_value, split_expr, \ standard_sc_str_fn, \ @@ -1979,8 +1979,13 @@ def _defaults_info(sc): for val, cond in sc.defaults: s += " - " if isinstance(sc, Symbol): - s += '{} (value: "{}")' \ - .format(_expr_str(val), TRI_TO_STR[expr_value(val)]) + s += _expr_str(val) + + # Don't show the value hint for string/int/hex symbols. The default + # can only be a single symbol there, and it makes no sense to show + # its tristate value (_expr_str() already shows its string value) + if sc.orig_type in (BOOL, TRISTATE): + s += ' (value: "{}")'.format(TRI_TO_STR[expr_value(val)]) else: # Don't print the value next to the symbol name for choice # defaults, as it looks a bit confusing |
