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 <marti@opensourcefoundries.com>
This commit is contained in:
parent
fbd2e92b42
commit
367c0bab6d
2 changed files with 3 additions and 22 deletions
|
@ -110,8 +110,7 @@ def do_run_common(command, args, runner_args, cached_runner_var):
|
|||
# Construct the final command line arguments, create a
|
||||
# runner-specific parser to handle them, and run the command.
|
||||
assert isinstance(runner_args, list), runner_args
|
||||
final_runner_args = (cached_common_args + cached_runner_args +
|
||||
runner_args + [command_name])
|
||||
final_runner_args = cached_common_args + cached_runner_args + runner_args
|
||||
|
||||
# Having the runners themselves be the place where their argument
|
||||
# parsing is handled is hackish; it's an artifact of the time
|
||||
|
|
|
@ -300,10 +300,7 @@ class ZephyrBinaryRunner(abc.ABC):
|
|||
* --dt-flash (if the runner capabilities includes flash_addr)
|
||||
|
||||
Runner-specific options are added through the do_add_parser()
|
||||
hook.
|
||||
|
||||
The single positional argument is "command". This is currently
|
||||
restricted to values 'flash', 'debug', and 'debugserver'.'''
|
||||
hook.'''
|
||||
# Required options.
|
||||
parser.add_argument('--board-dir', required=True,
|
||||
help='Zephyr board directory')
|
||||
|
@ -331,25 +328,10 @@ class ZephyrBinaryRunner(abc.ABC):
|
|||
# Runner-specific options.
|
||||
cls.do_add_parser(parser)
|
||||
|
||||
# The lone positional argument. Note that argparse can't cope
|
||||
# with adding options after the first positional argument, so
|
||||
# this must come last.
|
||||
parser.add_argument('command',
|
||||
choices=['flash', 'debug', 'debugserver'],
|
||||
help='command to run (flash, debug, debugserver)')
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def do_add_parser(cls, parser):
|
||||
'''Hook for adding runner-specific options.
|
||||
|
||||
Subclasses **must not** add positional arguments. That is, when
|
||||
calling parser.add_argument(), make sure to begin the argument
|
||||
with '-' so it is interpreted as an option, rather than a
|
||||
positional argument.
|
||||
|
||||
* OK: parser.add_argument('--my-option')
|
||||
* Not OK: parser.add_argument('my-argument').'''
|
||||
'''Hook for adding runner-specific options.'''
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue