Add --json argument to whois command

This commit is contained in:
Ivan Habunek 2023-11-18 15:27:18 +01:00
parent dd16627c89
commit 3de561a060
No known key found for this signature in database
GPG Key ID: F5F0623FF5EBCB3D
2 changed files with 8 additions and 3 deletions

View File

@ -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):

View File

@ -404,6 +404,7 @@ READ_COMMANDS = [
(["account"], {
"help": "account name or numeric ID"
}),
json_arg,
],
require_auth=True,
),