mirror of
https://github.com/r4sas/PBinCLI
synced 2025-08-27 06:02:12 +00:00
fix usage of debug option when command is not provided (closes #38)
Signed-off-by: R4SAS <r4sas@i2pmail.org>
This commit is contained in:
parent
ab7b2c060c
commit
43c5ef9618
@ -37,6 +37,8 @@ def read_config(filename):
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(description='Full-featured PrivateBin command-line client')
|
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")
|
subparsers = parser.add_subparsers(title="actions", help="List of commands")
|
||||||
|
|
||||||
# a send command
|
# a send command
|
||||||
@ -136,7 +138,7 @@ def main():
|
|||||||
for p in CONFIG_PATHS:
|
for p in CONFIG_PATHS:
|
||||||
if os.path.exists(p):
|
if os.path.exists(p):
|
||||||
fileconfig = read_config(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)
|
CONFIG.update(fileconfig)
|
||||||
break
|
break
|
||||||
|
|
||||||
@ -151,7 +153,7 @@ def main():
|
|||||||
# Re-validate PrivateBin instance URL
|
# Re-validate PrivateBin instance URL
|
||||||
CONFIG['server'] = validate_url_ending(CONFIG['server'])
|
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)
|
api_client = PrivateBin(CONFIG)
|
||||||
|
|
||||||
if hasattr(args, "func"):
|
if hasattr(args, "func"):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user