Skip to content

Commit 5a362aa

Browse files
committed
vmtest.rootfsbuild: make architecture -a option instead of positional
For consistency with the other CLIs. Signed-off-by: Omar Sandoval <[email protected]>
1 parent 2e1ccca commit 5a362aa

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

vmtest/rootfsbuild.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -163,19 +163,18 @@ def build_drgn_in_rootfs(rootfs: Path) -> None:
163163
help="make the rootfs a Btrfs subvolume and create a read-only snapshot",
164164
)
165165
parser.add_argument(
166-
"architectures",
167-
choices=["foreign", "all", *sorted(ARCHITECTURES)],
168-
nargs="*",
169-
# It would make more sense for this to be ["foreign"], but argparse
170-
# checks that the default itself is in choices, not each item. We fix
171-
# it up to a list below.
172-
default="foreign",
173-
help='architecture to build for, or "foreign" for all architectures other than the host architecture; may be given multiple times',
166+
"-a",
167+
"--architecture",
168+
dest="architectures",
169+
action="append",
170+
choices=["all", "foreign", *sorted(ARCHITECTURES)],
171+
default=argparse.SUPPRESS,
172+
help='architecture to build for, or "foreign" for all architectures other than the host architecture; may be given multiple times (default: foreign)',
174173
)
175174
args = parser.parse_args()
176175

177-
if isinstance(args.architectures, str):
178-
args.architectures = [args.architectures]
176+
if not hasattr(args, "architectures"):
177+
args.architectures = ["foreign"]
179178
architectures = []
180179
for name in args.architectures:
181180
if name == "foreign":

0 commit comments

Comments
 (0)