Skip to content

Commit

Permalink
Clean up cli for new publish/unpublish feature
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmymathews committed May 2, 2024
1 parent e06d675 commit 46f34b9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml.unversioned
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ packages = [
"drop_ondemand_computations.py",
"delete_feature.py",
"upload_sync_findings.py",
"publish.py",
"collection.py",
]
"spatialprofilingtoolbox.db.data_model" = [
"metaschema.sql",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@

def parse_args():
parser = argparse.ArgumentParser(
prog='spt db publish',
description='Promote datasets from a private collection to the general, public collection.',
prog='spt db collection',
description='Promote datasets from a private collection to the general, public collection, '
'or revert this action.',
)
add_argument(parser, 'database config')
parser.add_argument(
Expand All @@ -19,6 +20,17 @@ def parse_args():
help='The token/label for the study collection.',
required=True,
)
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument(
'--publish',
action='store_true',
default=False,
)
group.add_argument(
'--unpublish',
action='store_true',
default=False,
)
return parser.parse_args()


Expand All @@ -27,7 +39,10 @@ def main():
database_config_file = get_and_validate_database_config(args)
collection = args.collection
promoter = PublisherPromoter(database_config_file)
promoter.promote(collection)
if args.publish:
promoter.promote(collection)
if args.unpublish:
promoter.demote(collection)


if __name__=='__main__':
Expand Down

0 comments on commit 46f34b9

Please sign in to comment.