Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix combo of choice and type for DataFormat and DataCategory CLI args #532

Merged
merged 3 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions python/lib/client/dmod/client/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ def _handle_data_service_action_args(parent_subparsers_container):
action_subparsers = command_parser.add_subparsers(dest='action')
action_subparsers.required = True

dataset_categories = [e.name.lower() for e in DataCategory]
dataset_formats = [e.name for e in DataFormat]
dataset_categories = [e for e in DataCategory]
dataset_formats = [e for e in DataFormat]

# Nested parser for the 'create' action, with required argument for dataset name, category, and format
parser_create = action_subparsers.add_parser('create', description="Create a new dataset.")
Expand All @@ -220,9 +220,10 @@ def _handle_data_service_action_args(parent_subparsers_container):
parser_create.add_argument('--discrete-restriction', type=lambda s: DiscreteRestriction(**json.loads(s)),
dest='discrete_restrictions', nargs='*', help=d_restrict_help_str.format(d_json_form))
parser_create.add_argument('--format', dest='dataset_format', choices=dataset_formats, type=DataFormat.get_for_name,
help='Specify dataset domain format.')
metavar=f"{{{', '.join(f.name for f in dataset_formats)}}}", help='Specify dataset domain format.')
parser_create.add_argument('--domain-json', dest='domain_file', type=Path, help='Deserialize the dataset domain from a file.')
parser_create.add_argument('category', type=DataCategory.get_for_name, choices=dataset_categories, help='Specify dataset category.')
parser_create.add_argument('category', type=DataCategory.get_for_name, choices=dataset_categories,
metavar=f"{{{', '.join(c.name.lower() for c in dataset_categories)}", help='Specify dataset category.')

# Nested parser for the 'delete' action, with required argument for dataset name
parser_delete = action_subparsers.add_parser('delete', description="Delete a specified (entire) dataset.")
Expand All @@ -245,7 +246,7 @@ def _handle_data_service_action_args(parent_subparsers_container):
# Nested parser for the 'list_datasets' action
parser_list = action_subparsers.add_parser('list', description="List available datasets.")
parser_list.add_argument('--category', dest='category', choices=dataset_categories, type=DataCategory.get_for_name,
help='Specify the category of dataset to list')
metavar=f"{{{', '.join(c.name.lower() for c in dataset_categories)}", help='Specify the category of dataset to list')

# Nested parser for the 'list_items' action
parser_list = action_subparsers.add_parser('items', description="List items within a specified dataset.")
Expand Down
2 changes: 1 addition & 1 deletion python/lib/client/dmod/client/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.4.0'
__version__ = '0.4.1'
Loading