Skip to content
Snippets Groups Projects
Commit 7f2bf326 authored by Jon Crall's avatar Jon Crall
Browse files

format changes

parent 116e423a
No related branches found
No related tags found
1 merge request!24Start branch for dev/0.7.7
Pipeline #327743 failed
......@@ -13,3 +13,4 @@ numpy>=1.11.1 ; python_version < '3.4' and python_version >= '2.7' # Python
omegaconf>=2.2.2 ; python_version >= '3.6' # Python 3.6+
rich_argparse>=1.1.0; python_version >= '3.7'
argcomplete>=3.0.5
......@@ -222,6 +222,10 @@ class RawDescriptionDefaultsHelpFormatter(
for option_string in display_option_strings:
if SCFG_MODIFICATIONS:
if option_string.startswith('--no-'):
if isinstance(action.default, int) and action.default == 0:
# Dont bother telling the user they can turn
# something off when that is the default.
continue
parts.append('%s' % (option_string,))
else:
parts.append('%s %s' % (option_string, args_string))
......@@ -230,6 +234,9 @@ class RawDescriptionDefaultsHelpFormatter(
return ', '.join(parts)
def _rich_format_action_invocation(self, action):
"""
Mirrors _format_action_invocation but for rich-argparse
"""
from rich.text import Text
if not action.option_strings:
......@@ -254,6 +261,10 @@ class RawDescriptionDefaultsHelpFormatter(
args_string = self._format_args(action, default)
for option_string in display_option_strings:
if option_string.startswith('--no-'):
if isinstance(action.default, int) and action.default == 0:
# Dont bother telling the user they can turn
# something off when that is the default.
continue
part = Text(option_string, 'argparse.args')
else:
part = Text(" ").join([Text(option_string, 'argparse.args'), Text(args_string, 'argparse.metavar')])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment