Skip to content

Commit

Permalink
vmtest.rootfsbuild: make architecture -a option instead of positional
Browse files Browse the repository at this point in the history
For consistency with the other CLIs.

Signed-off-by: Omar Sandoval <[email protected]>
  • Loading branch information
osandov committed Aug 29, 2023
1 parent 2e1ccca commit 5a362aa
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions vmtest/rootfsbuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,19 +163,18 @@ def build_drgn_in_rootfs(rootfs: Path) -> None:
help="make the rootfs a Btrfs subvolume and create a read-only snapshot",
)
parser.add_argument(
"architectures",
choices=["foreign", "all", *sorted(ARCHITECTURES)],
nargs="*",
# It would make more sense for this to be ["foreign"], but argparse
# checks that the default itself is in choices, not each item. We fix
# it up to a list below.
default="foreign",
help='architecture to build for, or "foreign" for all architectures other than the host architecture; may be given multiple times',
"-a",
"--architecture",
dest="architectures",
action="append",
choices=["all", "foreign", *sorted(ARCHITECTURES)],
default=argparse.SUPPRESS,
help='architecture to build for, or "foreign" for all architectures other than the host architecture; may be given multiple times (default: foreign)',
)
args = parser.parse_args()

if isinstance(args.architectures, str):
args.architectures = [args.architectures]
if not hasattr(args, "architectures"):
args.architectures = ["foreign"]
architectures = []
for name in args.architectures:
if name == "foreign":
Expand Down

0 comments on commit 5a362aa

Please sign in to comment.