diff --git a/pyproject.toml.unversioned b/pyproject.toml.unversioned index 28e98a12..ed5f802c 100644 --- a/pyproject.toml.unversioned +++ b/pyproject.toml.unversioned @@ -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", diff --git a/spatialprofilingtoolbox/db/scripts/publish.py b/spatialprofilingtoolbox/db/scripts/collection.py similarity index 65% rename from spatialprofilingtoolbox/db/scripts/publish.py rename to spatialprofilingtoolbox/db/scripts/collection.py index 472e3513..161e0e9b 100644 --- a/spatialprofilingtoolbox/db/scripts/publish.py +++ b/spatialprofilingtoolbox/db/scripts/collection.py @@ -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( @@ -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() @@ -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__':