mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 01:57:13 +02:00
More cosmetic changes to Org CLI
This commit is contained in:
@ -34,7 +34,7 @@ def validate_username(value, field="username"):
|
|||||||
if not re.match(r"^[a-z\d](?:[a-z\d]|-(?=[a-z\d])){0,37}$", value, flags=re.I):
|
if not re.match(r"^[a-z\d](?:[a-z\d]|-(?=[a-z\d])){0,37}$", value, flags=re.I):
|
||||||
raise click.BadParameter(
|
raise click.BadParameter(
|
||||||
"Invalid %s format. "
|
"Invalid %s format. "
|
||||||
"%s may only contain alphanumeric characters "
|
"%s must only contain alphanumeric characters "
|
||||||
"or single hyphens, cannot begin or end with a hyphen, "
|
"or single hyphens, cannot begin or end with a hyphen, "
|
||||||
"and must not be longer than 38 characters."
|
"and must not be longer than 38 characters."
|
||||||
% (field.lower(), field.capitalize())
|
% (field.lower(), field.capitalize())
|
||||||
|
@ -43,7 +43,9 @@ def validate_orgname(value):
|
|||||||
def org_create(orgname, email, display_name):
|
def org_create(orgname, email, display_name):
|
||||||
client = AccountClient()
|
client = AccountClient()
|
||||||
client.create_org(orgname, email, display_name)
|
client.create_org(orgname, email, display_name)
|
||||||
return click.secho("An organization has been successfully created.", fg="green",)
|
return click.secho(
|
||||||
|
"The organization %s has been successfully created." % orgname, fg="green",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@cli.command("list", short_help="List organizations")
|
@cli.command("list", short_help="List organizations")
|
||||||
@ -100,7 +102,9 @@ def org_update(orgname, **kwargs):
|
|||||||
{key.replace("new_", ""): value for key, value in kwargs.items() if value}
|
{key.replace("new_", ""): value for key, value in kwargs.items() if value}
|
||||||
)
|
)
|
||||||
client.update_org(orgname, new_org)
|
client.update_org(orgname, new_org)
|
||||||
return click.secho("An organization has been successfully updated.", fg="green",)
|
return click.secho(
|
||||||
|
"The organization %s has been successfully updated." % orgname, fg="green",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@cli.command("add", short_help="Add a new owner to organization")
|
@cli.command("add", short_help="Add a new owner to organization")
|
||||||
@ -110,7 +114,9 @@ def org_add_owner(orgname, username):
|
|||||||
client = AccountClient()
|
client = AccountClient()
|
||||||
client.add_org_owner(orgname, username)
|
client.add_org_owner(orgname, username)
|
||||||
return click.secho(
|
return click.secho(
|
||||||
"A new owner has been successfully added to the organization.", fg="green",
|
"The new owner %s has been successfully added to the %s organization."
|
||||||
|
% (username, orgname),
|
||||||
|
fg="green",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -121,5 +127,7 @@ def org_remove_owner(orgname, username):
|
|||||||
client = AccountClient()
|
client = AccountClient()
|
||||||
client.remove_org_owner(orgname, username)
|
client.remove_org_owner(orgname, username)
|
||||||
return click.secho(
|
return click.secho(
|
||||||
"An owner has been successfully removed from the organization.", fg="green",
|
"The %s owner has been successfully removed from the %s organization."
|
||||||
|
% (username, orgname),
|
||||||
|
fg="green",
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user