From 29ff62946461afe1d6bfa27a2a5338134412da5f Mon Sep 17 00:00:00 2001 From: Ivan Habunek Date: Sun, 11 Dec 2022 23:46:54 +0100 Subject: [PATCH] Add toot env command --- toot/commands.py | 9 ++++++++- toot/console.py | 6 ++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/toot/commands.py b/toot/commands.py index 7319e7e..5cbde45 100644 --- a/toot/commands.py +++ b/toot/commands.py @@ -1,9 +1,10 @@ # -*- coding: utf-8 -*- import sys +import platform from datetime import datetime, timedelta, timezone -from toot import api, config +from toot import api, config, __version__ from toot.auth import login_interactive, login_browser_interactive, create_app_interactive from toot.exceptions import ApiError, ConsoleError from toot.output import (print_out, print_instance, print_account, print_acct_list, @@ -220,6 +221,12 @@ def auth(app, user, args): print_out("\nAuth tokens are stored in: {}".format(path)) +def env(app, user, args): + print_out(f"toot {__version__}") + print_out(f"Python {sys.version}") + print_out(platform.platform()) + + def login_cli(app, user, args): app = create_app_interactive(instance=args.instance, scheme=args.scheme) login_interactive(app, args.email) diff --git a/toot/console.py b/toot/console.py index 71ced98..dbb681a 100644 --- a/toot/console.py +++ b/toot/console.py @@ -223,6 +223,12 @@ AUTH_COMMANDS = [ arguments=[], require_auth=False, ), + Command( + name="env", + description="Print environment information for inclusion in bug reports.", + arguments=[], + require_auth=False, + ), ] TUI_COMMANDS = [