diff --git a/platformio/clients/registry.py b/platformio/clients/registry.py index 123b3239..f90282d8 100644 --- a/platformio/clients/registry.py +++ b/platformio/clients/registry.py @@ -17,13 +17,15 @@ from platformio.clients.account import AccountClient from platformio.clients.rest import RESTClient from platformio.package.spec import PackageType +# pylint: disable=too-many-arguments + class RegistryClient(RESTClient): def __init__(self): super(RegistryClient, self).__init__(base_url=__registry_api__) def publish_package( - self, archive_path, owner=None, released_at=None, private=False + self, archive_path, owner=None, released_at=None, private=False, notify=True ): account = AccountClient() if not owner: @@ -34,7 +36,11 @@ class RegistryClient(RESTClient): response = self.send_request( "post", "/v3/package/%s/%s" % (owner, PackageType.from_archive(archive_path)), - params={"private": 1 if private else 0, "released_at": released_at}, + params={ + "private": 1 if private else 0, + "notify": 1 if notify else 0, + "released_at": released_at, + }, headers={ "Authorization": "Bearer %s" % account.fetch_authentication_token(), "Content-Type": "application/octet-stream", @@ -46,7 +52,7 @@ class RegistryClient(RESTClient): ) return response - def unpublish_package( # pylint: disable=redefined-builtin,too-many-arguments + def unpublish_package( # pylint: disable=redefined-builtin self, type, name, owner=None, version=None, undo=False ): account = AccountClient() diff --git a/platformio/commands/package.py b/platformio/commands/package.py index b42d34b7..e5eb7db6 100644 --- a/platformio/commands/package.py +++ b/platformio/commands/package.py @@ -58,11 +58,16 @@ def package_pack(package): help="Custom release date and time in the next format (UTC): 2014-06-13 17:08:52", ) @click.option("--private", is_flag=True, help="Restricted access (not a public)") -def package_publish(package, owner, released_at, private): +@click.option( + "--notify/--no-notify", + default=True, + help="Notify by email when package is processed", +) +def package_publish(package, owner, released_at, private, notify): p = PackagePacker(package) archive_path = p.pack() response = RegistryClient().publish_package( - archive_path, owner, released_at, private + archive_path, owner, released_at, private, notify ) os.remove(archive_path) click.secho(response.get("message"), fg="green")