diff options
| author | pi coding agent <pi@localhost> | 2026-10-22 18:59:33 +0000 |
|---|---|---|
| committer | Frederick Muriuki Muriithi <fredmanglis@gmail.com> | 2026-10-22 14:25:09 -0500 |
| commit | a897ceca02b78a9426652ac3092c79278cdc681c (patch) | |
| tree | 1ed499d3c583c93890d30864871740a276e4f718 /uploader/scripts/cli/options.py | |
| parent | e3859b3945606aed7bd6a3861af8a525e061a2b1 (diff) | |
| download | gn-uploader-a897ceca02b78a9426652ac3092c79278cdc681c.tar.gz | |
Move scripts into the uploader package
Move the top-level `scripts` package to `uploader/scripts` so that it becomes the `uploader.scripts` package. All files are moved unchanged; references are updated in a follow-up commit.
Diffstat (limited to 'uploader/scripts/cli/options.py')
| -rw-r--r-- | uploader/scripts/cli/options.py | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/uploader/scripts/cli/options.py b/uploader/scripts/cli/options.py new file mode 100644 index 0000000..58d3df4 --- /dev/null +++ b/uploader/scripts/cli/options.py @@ -0,0 +1,56 @@ +"""General options to be added to CLI scripts.""" +from argparse import ArgumentParser + + +def add_logging(parser: ArgumentParser) -> ArgumentParser: + """Add optional log-level option""" + loglevels = ("debug", "info", "warning", "error", "critical") + parser.add_argument( + "--log_level", + "--log-level", + "--loglevel", + metavar="LOG-LEVEL", + type=str, + default="INFO", + choices=loglevels, + help=("Controls the severity of events to log. Valid values are: " + + ", ".join(f"'{level}'" for level in loglevels))) + return parser + + +def add_mariadb_uri(parser: ArgumentParser) -> ArgumentParser: + """Add the MySQL/MariaDB URI argument.""" + parser.add_argument("db_uri", + metavar="DB-URI", + type=str, + help="MariaDB/MySQL connection URL") + return parser + + +def add_species_id(parser: ArgumentParser) -> ArgumentParser: + """Add species-id as a mandatory argument.""" + parser.add_argument("species_id", + metavar="SPECIES-ID", + type=int, + help="The species to operate on.") + return parser + + +def add_population_id(parser: ArgumentParser) -> ArgumentParser: + """Add population-id as a mandatory argument.""" + parser = add_species_id(parser) + parser.add_argument("population_id", + metavar="POPULATION-ID", + type=int, + help="The ID for the population to operate on.") + return parser + + +def add_dataset_id(parser: ArgumentParser) -> ArgumentParser: + """Add dataset-id as a mandatory argument.""" + parser = add_population_id(parser) + parser.add_argument("dataset_id", + metavar="DATASET-ID", + type=int, + help="The ID for the dataset to operate on.") + return parser |
