Skip to content

Commit

Permalink
feat: update formatting and usability of CLI options
Browse files Browse the repository at this point in the history
  • Loading branch information
ejseqera committed Jan 10, 2024
1 parent a34d85a commit 836494a
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 29 deletions.
3 changes: 3 additions & 0 deletions seqerakit/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import importlib.metadata as importlib_metadata

__version__ = importlib_metadata.version(__name__)
69 changes: 40 additions & 29 deletions seqerakit/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,69 +31,80 @@


def parse_args(args=None):
parser = argparse.ArgumentParser()
parser.add_argument(
parser = argparse.ArgumentParser(
description="Seqerakit: Python wrapper for the Seqera Platform CLI"
)

# General options
general = parser.add_argument_group("General Options")
general.add_argument(
"-l",
"--log_level",
default="INFO",
choices=("CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG"),
help="The desired log level (default: INFO).",
type=str.upper,
help="Set the logging level.",
)
parser.add_argument(
general.add_argument(
"--info",
"-i",
action="store_true",
help="Display information about the Seqera Platform and exit",
help="Display Seqera Platform information and exit.",
)
parser.add_argument(
general.add_argument(
"--dryrun",
"-d",
action="store_true",
help="Print the commands that would be executed without running them.",
help="Print the commands that would be executed.",
)
parser.add_argument(
general.add_argument(
"--version",
"-v",
action="version",
version=f"%(prog)s {__version__}",
help="Show version number and exit.",
)

# YAML processing options
yaml_processing = parser.add_argument_group("YAML Processing Options")
yaml_processing.add_argument(
"yaml",
type=Path,
nargs="*", # allow multiple YAML paths
help="One or more YAML files with Seqera Platform resources to create",
nargs="*",
help="One or more YAML files with Seqera Platform resource definitions.",
)
parser.add_argument(
yaml_processing.add_argument(
"--delete",
action="store_true",
help="Recursively delete all resources defined in the YAML file(s)",
help="Recursively delete resources defined in the YAML files.",
)
parser.add_argument(
yaml_processing.add_argument(
"--cli",
dest="cli_args",
type=str,
help="Additional arguments to pass to Seqera Platform"
" CLI enclosed in double quotes (e.g. '--cli=\"--insecure\"')",
)
parser.add_argument(
"dump",
help="Dump definitions for entities in the workspace to YAML file(s)",

# YAML dumping options
yaml_dumping = parser.add_argument_group("YAML Dumping Options")
yaml_dumping.add_argument(
"--dump", help="Dump Seqera Platform entity definitions to YAML."
)
parser.add_argument(
yaml_dumping.add_argument(
"--workspace",
"-w",
dest="workspace",
type=str,
help="Name of the workspace to dump YAML definitions for",
help="Name/ID of the workspace to dump YAML definitions for",
)
parser.add_argument(
yaml_dumping.add_argument(
"--prefix",
"-p",
dest="prefix",
type=str,
help="Prefix to use for outputting YAML definition files (optional)\n"
"If not provided, the workspace name will be used as the prefix",
)
parser.add_argument(
"--version",
"-v",
action="version",
version=f"%(prog)s v{__version__}",
help="Show the current version number and exit",
help="Prefix for output YAML files (defaults to workspace name).",
)

return parser.parse_args(args)


Expand Down

0 comments on commit 836494a

Please sign in to comment.