Skip to content

Commit 367c0ba

Browse files
Marti Bolivarnashif
authored andcommitted
scripts: west: remove command from runner arguments
This is redundant information. The command is already known from the top-level west command line. We can just feed it to run without inserting it on the command line as well, which is safe to do now that zephyr_flash_debug.py is gone. Signed-off-by: Marti Bolivar <[email protected]>
1 parent fbd2e92 commit 367c0ba

File tree

2 files changed

+3
-22
lines changed

2 files changed

+3
-22
lines changed

scripts/meta/west/cmd/run_common.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,7 @@ def do_run_common(command, args, runner_args, cached_runner_var):
110110
# Construct the final command line arguments, create a
111111
# runner-specific parser to handle them, and run the command.
112112
assert isinstance(runner_args, list), runner_args
113-
final_runner_args = (cached_common_args + cached_runner_args +
114-
runner_args + [command_name])
113+
final_runner_args = cached_common_args + cached_runner_args + runner_args
115114

116115
# Having the runners themselves be the place where their argument
117116
# parsing is handled is hackish; it's an artifact of the time

scripts/meta/west/runner/core.py

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -300,10 +300,7 @@ def add_parser(cls, parser):
300300
* --dt-flash (if the runner capabilities includes flash_addr)
301301
302302
Runner-specific options are added through the do_add_parser()
303-
hook.
304-
305-
The single positional argument is "command". This is currently
306-
restricted to values 'flash', 'debug', and 'debugserver'.'''
303+
hook.'''
307304
# Required options.
308305
parser.add_argument('--board-dir', required=True,
309306
help='Zephyr board directory')
@@ -331,25 +328,10 @@ def add_parser(cls, parser):
331328
# Runner-specific options.
332329
cls.do_add_parser(parser)
333330

334-
# The lone positional argument. Note that argparse can't cope
335-
# with adding options after the first positional argument, so
336-
# this must come last.
337-
parser.add_argument('command',
338-
choices=['flash', 'debug', 'debugserver'],
339-
help='command to run (flash, debug, debugserver)')
340-
341331
@classmethod
342332
@abc.abstractmethod
343333
def do_add_parser(cls, parser):
344-
'''Hook for adding runner-specific options.
345-
346-
Subclasses **must not** add positional arguments. That is, when
347-
calling parser.add_argument(), make sure to begin the argument
348-
with '-' so it is interpreted as an option, rather than a
349-
positional argument.
350-
351-
* OK: parser.add_argument('--my-option')
352-
* Not OK: parser.add_argument('my-argument').'''
334+
'''Hook for adding runner-specific options.'''
353335

354336
@classmethod
355337
@abc.abstractmethod

0 commit comments

Comments
 (0)