diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2013-08-07 02:05:18 +0200 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2013-08-07 02:08:06 +0200 |
| commit | 06309e301b0008605c4f2c5ad1d3a07276e3865c (patch) | |
| tree | b5c617042179ca83351abd2b273626ef452daae7 /kconfiglib.py | |
| parent | 4f7b2b25dbb66369b8099f596b4593956e9d1cc9 (diff) | |
Add Symbol and Choice interfaces for getting prompt strings.
Diffstat (limited to 'kconfiglib.py')
| -rw-r--r-- | kconfiglib.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/kconfiglib.py b/kconfiglib.py index 0704cc0..743d48f 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -2495,6 +2495,16 @@ class Symbol(Item, _HasVisibility): """Returns the name of the symbol.""" return self.name + def get_prompts(self): + """Returns a list of prompts defined for the symbol, in the order they + appear in the configuration files. Returns the empty list for symbols + with no prompt. + + This list will have a single entry for the vast majority of symbols + having prompts, but having multiple prompts for a single symbol is + possible through having multiple 'config' entries for it.""" + return [prompt for prompt, _ in self.orig_prompts] + def get_upper_bound(self): """For string/hex/int symbols and for bool and tristate symbols that cannot be modified (see is_modifiable()), returns None. @@ -3230,6 +3240,17 @@ class Choice(Item, _HasVisibility): as of Linux 3.7.0-rc8.""" return self.name + def get_prompts(self): + """Returns a list of prompts defined for the choice, in the order they + appear in the configuration files. Returns the empty list for choices + with no prompt. + + This list will have a single entry for the vast majority of choices + having prompts, but having multiple prompts for a single choice is + possible through having multiple 'choice' entries for it (though I'm + not sure if that ever happens in practice).""" + return [prompt for prompt, _ in self.orig_prompts] + def get_help(self): """Returns the help text of the choice, or None if the choice has no help text.""" |
