From 43c5ef961838ff4958bd5e6d54ebe5fe12ec8738 Mon Sep 17 00:00:00 2001 From: R4SAS Date: Thu, 23 Feb 2023 07:39:38 +0000 Subject: [PATCH] fix usage of debug option when command is not provided (closes #38) Signed-off-by: R4SAS --- pbincli/cli.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pbincli/cli.py b/pbincli/cli.py index 917a2f3..7abe37d 100755 --- a/pbincli/cli.py +++ b/pbincli/cli.py @@ -37,6 +37,8 @@ def read_config(filename): def main(): parser = argparse.ArgumentParser(description='Full-featured PrivateBin command-line client') + parser.add_argument("-d", "--debug", default=False, action="store_true", help="Enable debug output") + subparsers = parser.add_subparsers(title="actions", help="List of commands") # a send command @@ -136,7 +138,7 @@ def main(): for p in CONFIG_PATHS: if os.path.exists(p): fileconfig = read_config(p) - if args.debug: print("Configuration readed from file:\t{}".format(fileconfig)) + if args.debug: print("Configuration readed from file:\n{}".format(fileconfig)) CONFIG.update(fileconfig) break @@ -151,7 +153,7 @@ def main(): # Re-validate PrivateBin instance URL CONFIG['server'] = validate_url_ending(CONFIG['server']) - if args.debug: print("Whole configuration:\t\t{}".format(CONFIG)) + if args.debug: print("Whole configuration:\n{}\n".format(CONFIG)) api_client = PrivateBin(CONFIG) if hasattr(args, "func"):