Add --json argument to whois command
This commit is contained in:
parent
dd16627c89
commit
3de561a060
2 changed files with 8 additions and 3 deletions
|
@ -1,4 +1,4 @@
|
|||
|
||||
import json
|
||||
import sys
|
||||
import platform
|
||||
|
||||
|
@ -526,8 +526,12 @@ def whoami(app, user, args):
|
|||
|
||||
def whois(app, user, args):
|
||||
account = api.find_account(app, user, args.account)
|
||||
account = from_dict(Account, account)
|
||||
print_account(account)
|
||||
# Here it's not possible to avoid parsing json since it's needed to find the account.
|
||||
if args.json:
|
||||
print(json.dumps(account))
|
||||
else:
|
||||
account = from_dict(Account, account)
|
||||
print_account(account)
|
||||
|
||||
|
||||
def instance(app, user, args):
|
||||
|
|
|
@ -404,6 +404,7 @@ READ_COMMANDS = [
|
|||
(["account"], {
|
||||
"help": "account name or numeric ID"
|
||||
}),
|
||||
json_arg,
|
||||
],
|
||||
require_auth=True,
|
||||
),
|
||||
|
|
Loading…
Reference in a new issue