diff --git a/swh/deposit/cli/client.py b/swh/deposit/cli/client.py --- a/swh/deposit/cli/client.py +++ b/swh/deposit/cli/client.py @@ -334,7 +334,14 @@ @click.option( "--slug", help=( - "(Optional) External system information identifier. " + "(Deprecated) (Optional) External system information identifier. " + "If not provided, it will be generated" + ), +) +@click.option( + "--create-origin", + help=( + "(Optional) Origin url to attach information to. " "If not provided, it will be generated" ), ) @@ -381,6 +388,7 @@ metadata_deposit: bool, collection: Optional[str], slug: Optional[str], + create_origin: Optional[str], partial: bool, deposit_id: Optional[int], swhid: Optional[str], @@ -412,6 +420,21 @@ DeprecationWarning, ) + if slug: + if create_origin and slug != create_origin: + msg = ( + '"--slug" flag has been deprecated in favor of "--create-origin" flag. ' + 'No need to mention both the "--slug" and the flag "--create-origin", ' + 'continuing with "--create-origin"' + ) + else: + msg = ( + '"--slug" flag has been deprecated in favor of "--create-origin" flag, ' + 'simply start using --create-origin instead of "--slug"' + ) + create_origin = slug + warnings.warn(msg, DeprecationWarning) + url = _url(url) client = PublicApiDepositClient(url=url, auth=(username, password)) @@ -424,7 +447,7 @@ archive, metadata, collection, - slug, + create_origin, partial, deposit_id, swhid,