More cosmetic changes to Org CLI

This commit is contained in:
Ivan Kravets
2020-06-03 22:34:37 +03:00
parent 6c97cc6192
commit 87b5fbd237
2 changed files with 13 additions and 5 deletions

View File

@ -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):
raise click.BadParameter(
"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, "
"and must not be longer than 38 characters."
% (field.lower(), field.capitalize())

View File

@ -43,7 +43,9 @@ def validate_orgname(value):
def org_create(orgname, email, display_name):
client = AccountClient()
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")
@ -100,7 +102,9 @@ def org_update(orgname, **kwargs):
{key.replace("new_", ""): value for key, value in kwargs.items() if value}
)
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")
@ -110,7 +114,9 @@ def org_add_owner(orgname, username):
client = AccountClient()
client.add_org_owner(orgname, username)
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.remove_org_owner(orgname, username)
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",
)