mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-09 11:02:57 +00:00
Improve handling common parser arguments (#2221)
This commit is contained in:
39
tagging/common_arguments.py
Normal file
39
tagging/common_arguments.py
Normal file
@@ -0,0 +1,39 @@
|
||||
import argparse
|
||||
|
||||
|
||||
def common_arguments_parser(
|
||||
registry: bool = True,
|
||||
owner: bool = True,
|
||||
short_image_name: bool = True,
|
||||
variant: bool = True,
|
||||
) -> argparse.ArgumentParser:
|
||||
"""Add common CLI arguments to parser"""
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
if registry:
|
||||
parser.add_argument(
|
||||
"--registry",
|
||||
required=True,
|
||||
choices=["docker.io", "quay.io"],
|
||||
help="Image registry",
|
||||
)
|
||||
if owner:
|
||||
parser.add_argument(
|
||||
"--owner",
|
||||
required=True,
|
||||
help="Owner of the image",
|
||||
)
|
||||
if short_image_name:
|
||||
parser.add_argument(
|
||||
"--short-image-name",
|
||||
required=True,
|
||||
help="Short image name",
|
||||
)
|
||||
if variant:
|
||||
parser.add_argument(
|
||||
"--variant",
|
||||
required=True,
|
||||
help="Variant tag prefix",
|
||||
)
|
||||
|
||||
return parser
|
Reference in New Issue
Block a user