Skip to content

Commit 48ed3a0

Browse files
committed
Improve argument coloring where available
* Use %(default)s where appropriate * Otherwise, use backticks around default values * Use backticks when referring to console commands, such as references to other command line options or example command invocations
1 parent 6428dca commit 48ed3a0

7 files changed

Lines changed: 18 additions & 14 deletions

File tree

colcon_core/command.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
"""Environment variable to set the warnings filter for colcon modules"""
2020
WARNINGS_ENVIRONMENT_VARIABLE = EnvironmentVariable(
2121
'COLCON_WARNINGS',
22-
'Set the warnings filter similar to PYTHONWARNINGS except that the module '
23-
"entry is implicitly set to 'colcon.*'")
22+
'Set the warnings filter similar to `PYTHONWARNINGS` except that the '
23+
'module entry is implicitly set to `colcon.*`')
2424

2525
warnings_filters = os.environ.get(WARNINGS_ENVIRONMENT_VARIABLE.name)
2626
if warnings_filters:
@@ -75,7 +75,7 @@
7575
"""Environment variable to set the configuration directory"""
7676
HOME_ENVIRONMENT_VARIABLE = EnvironmentVariable(
7777
'COLCON_HOME',
78-
'Set the configuration directory (default: ~/.colcon)')
78+
'Set the configuration directory (default: `~/.colcon`)')
7979

8080

8181
_command_exit_handlers = []
@@ -379,12 +379,12 @@ def add_log_level_argument(parser):
379379
"""
380380
parser.add_argument(
381381
'--log-base',
382-
help='The base path for all log directories (default: ./log, to '
383-
f'disable: {os.devnull})')
382+
help='The base path for all log directories (default: `./log`, to '
383+
f'disable: `{os.devnull}`)')
384384
parser.add_argument(
385385
'--log-level', action=LogLevelAction,
386386
help='Set log level for the console output, either by numeric or '
387-
'string value (default: warning)')
387+
'string value (default: `warning`)')
388388

389389

390390
class LogLevelAction(argparse.Action):

colcon_core/executor/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ def add_executor_arguments(parser):
254254

255255
group.add_argument(
256256
'--executor', type=str, choices=keys, default=default,
257-
help=f'The executor to process all packages (default: {default})'
257+
help=f'The executor to process all packages (default: %(default)s)'
258258
f'{descriptions}') # noqa: E131
259259

260260
for priority in extensions.keys():

colcon_core/package_discovery/path.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def add_arguments( # noqa: D102
3636
type=get_cwd_path_resolver(),
3737
help='The paths to check for a package. Use shell wildcards '
3838
'(e.g. `src/*`) to select all direct subdirectories' +
39-
(' (default: .)' if with_default else ''))
39+
(' (default: `.`)' if with_default else ''))
4040

4141
def has_parameters(self, *, args): # noqa: D102
4242
return not is_default_value(args.paths) and \

colcon_core/task/python/test/pytest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def add_arguments(self, *, parser): # noqa: D102
3939
nargs='*', metavar='*', type=str.lstrip,
4040
help='Pass arguments to pytests. '
4141
'Arguments matching other options must be prefixed by a space,\n'
42-
'e.g. --pytest-args " --help" (stdout might not be shown by '
42+
'e.g. `--pytest-args " --help"` (stdout might not be shown by '
4343
'default, e.g. add `--event-handlers console_cohesion+`)')
4444
parser.add_argument(
4545
'--pytest-with-coverage',

colcon_core/task/python/test/setuppy_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def add_arguments(self, *, parser): # noqa: D102
2323
nargs='*', metavar='*', type=str.lstrip,
2424
help='Pass arguments to Python unittests. '
2525
'Arguments matching other options must be prefixed by a space,\n'
26-
'e.g. --unittest-args " --help" (stdout might not be shown by '
26+
'e.g. `--unittest-args " --help"` (stdout might not be shown by '
2727
'default, e.g. add `--event-handlers console_cohesion+`)')
2828

2929
def match(self, context, env, setup_py_data): # noqa: D102

colcon_core/verb/build.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,14 @@ def add_arguments(self, *, parser): # noqa: D102
8686
'--build-base',
8787
default=wrap_default_value('build'),
8888
type=get_cwd_path_resolver(),
89-
help='The base path for all build directories (default: build)')
89+
help='The base path for all build directories '
90+
'(default: %(default)s)')
9091
parser.add_argument(
9192
'--install-base',
9293
default=wrap_default_value('install'),
9394
type=get_cwd_path_resolver(),
94-
help='The base path for all install prefixes (default: install)')
95+
help='The base path for all install prefixes '
96+
'(default: %(default)s)')
9597
parser.add_argument(
9698
'--merge-install',
9799
action='store_true',
@@ -103,7 +105,8 @@ def add_arguments(self, *, parser): # noqa: D102
103105
parser.add_argument(
104106
'--test-result-base',
105107
type=get_cwd_path_resolver(),
106-
help='The base path for all test results (default: --build-base)')
108+
help='The base path for all test results '
109+
'(default: same as `--build-base`)')
107110
parser.add_argument(
108111
'--continue-on-error',
109112
action='store_true',

colcon_core/verb/test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ def add_arguments(self, *, parser): # noqa: D102
103103
parser.add_argument(
104104
'--test-result-base',
105105
type=get_cwd_path_resolver(),
106-
help='The base path for all test results (default: --build-base)')
106+
help='The base path for all test results '
107+
'(default: same as `--build-base`)')
107108
group = parser.add_mutually_exclusive_group()
108109
group.add_argument(
109110
'--retest-until-fail',

0 commit comments

Comments
 (0)