Skip to content

Commit

Permalink
Make rich tracebacks a cli option. (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
isilanes authored Oct 11, 2022
1 parent f7b7b27 commit 7927c28
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions lister.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
from rich.table import Table


# Automatic rich traceback handler
NICE_TRACEBACK = False
if NICE_TRACEBACK:
from rich.traceback import install
install(show_locals=True)
ERROR_STYLE = "bold red"
WARNING_STYLE = "bold yellow"

Expand Down Expand Up @@ -56,8 +51,18 @@
parser.add_argument('-fv','--filter_value', help='Value used for filtering (one or more)', required=False, default=None, nargs='*')
parser.add_argument('-i','--instance-id', help='Get instance details nicely formatted', required=False, default=None)
parser.add_argument('-l','--list', help='Amount of instances per region (one or more)', required=False, default=None, action='store_true')
parser.add_argument(
"--rich-traceback",
action="store_true",
help="Rich traceback. Default: regular traceback.",
default=False,
)
args = vars(parser.parse_args())

if args.get("rich_traceback"):
from rich.traceback import install
install(show_locals=True)

console = Console()


Expand Down

0 comments on commit 7927c28

Please sign in to comment.