Get a string to specify for the help text indicating the current command option value, if set, or the default. Arguments: command: A command name or, "global" for global options. option: Command-line option to set within `command`. show_default: A
(self, command: str, option: str, show_default: bool | None = None)
| 807 | return value |
| 808 | |
| 809 | def get_help_string(self, command: str, option: str, show_default: bool | None = None) -> str: |
| 810 | """Get a string to specify for the help text indicating the current command option value, |
| 811 | if set, or the default. |
| 812 | |
| 813 | Arguments: |
| 814 | command: A command name or, "global" for global options. |
| 815 | option: Command-line option to set within `command`. |
| 816 | show_default: Always show default value. Default is False for flag/bool values, |
| 817 | True otherwise. |
| 818 | """ |
| 819 | assert command in CONFIG_MAP and option in CONFIG_MAP[command] |
| 820 | is_flag = isinstance(CONFIG_MAP[command][option], bool) |
| 821 | if command in self._config and option in self._config[command]: |
| 822 | if is_flag: |
| 823 | value_str = "on" if self._config[command][option] else "off" |
| 824 | else: |
| 825 | value_str = str(self._config[command][option]) |
| 826 | return f" [setting: {value_str}]" |
| 827 | if show_default is False or ( |
| 828 | show_default is None and is_flag and CONFIG_MAP[command][option] is False |
| 829 | ): |
| 830 | return "" |
| 831 | return f" [default: {CONFIG_MAP[command][option]!s}]" |
nothing calls this directly
no outgoing calls
no test coverage detected