kopia lustrzana https://github.com/ihabunek/toot
Add --json argument to whois command
rodzic
dd16627c89
commit
3de561a060
|
@ -1,4 +1,4 @@
|
||||||
|
import json
|
||||||
import sys
|
import sys
|
||||||
import platform
|
import platform
|
||||||
|
|
||||||
|
@ -526,8 +526,12 @@ def whoami(app, user, args):
|
||||||
|
|
||||||
def whois(app, user, args):
|
def whois(app, user, args):
|
||||||
account = api.find_account(app, user, args.account)
|
account = api.find_account(app, user, args.account)
|
||||||
account = from_dict(Account, account)
|
# Here it's not possible to avoid parsing json since it's needed to find the account.
|
||||||
print_account(account)
|
if args.json:
|
||||||
|
print(json.dumps(account))
|
||||||
|
else:
|
||||||
|
account = from_dict(Account, account)
|
||||||
|
print_account(account)
|
||||||
|
|
||||||
|
|
||||||
def instance(app, user, args):
|
def instance(app, user, args):
|
||||||
|
|
|
@ -404,6 +404,7 @@ READ_COMMANDS = [
|
||||||
(["account"], {
|
(["account"], {
|
||||||
"help": "account name or numeric ID"
|
"help": "account name or numeric ID"
|
||||||
}),
|
}),
|
||||||
|
json_arg,
|
||||||
],
|
],
|
||||||
require_auth=True,
|
require_auth=True,
|
||||||
),
|
),
|
||||||
|
|
Ładowanie…
Reference in New Issue