Skip to content

Commit cdb56ca

Browse files
committed
scripts: runners: nrf: Add a new --dry-run parameter
In order to allow for users to invoke "west flash" without actual hardware connected but still running the logic and pregeneration of commands. Signed-off-by: Carles Cufi <[email protected]>
1 parent e14d83f commit cdb56ca

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

scripts/west_commands/runners/nrf_common.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ def do_add_parser(cls, parser):
118118
choices=['none', 'ranges', 'all'],
119119
help='Select the type of erase operation for the '
120120
'external non-volatile memory')
121+
parser.add_argument('--dry-run', required=False,
122+
action='store_true',
123+
help='''Generate all the commands without actually
124+
executing them''')
121125

122126
parser.set_defaults(reset=True)
123127

@@ -139,7 +143,10 @@ def ensure_snr(self):
139143
self.dev_id = [d.lstrip("0") for d in dev_id]
140144
return
141145
if not dev_id or "*" in dev_id:
142-
dev_id = self.get_board_snr(dev_id or "*")
146+
if not self.dry_run:
147+
dev_id = self.get_board_snr(dev_id or "*")
148+
else:
149+
dev_id = "DEVICEID" # for a dry run
143150
self.dev_id = dev_id.lstrip("0")
144151

145152
@abc.abstractmethod

0 commit comments

Comments
 (0)