Skip to content

Commit

Permalink
fix usage of debug option when command is not provided (closes #38)
Browse files Browse the repository at this point in the history
Signed-off-by: R4SAS <[email protected]>
  • Loading branch information
r4sas committed Feb 23, 2023
1 parent ab7b2c0 commit 43c5ef9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pbincli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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"):
Expand Down

0 comments on commit 43c5ef9

Please sign in to comment.