From 39158439431d65eca2911f753e2d60ef2b08cb7d Mon Sep 17 00:00:00 2001 From: Darksider3 Date: Sat, 12 Oct 2019 12:26:13 +0200 Subject: [PATCH] introducing the -u flag, which turns on the 'unapproved' mode. Oh, and just testing it in ListUsers.py :) --- private/ListUsers.py | 4 ++++ private/lib/CFG.py | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/private/ListUsers.py b/private/ListUsers.py index 43bd036..81bf72d 100644 --- a/private/ListUsers.py +++ b/private/ListUsers.py @@ -6,6 +6,10 @@ import lib.CFG as CFG if __name__ == "__main__": try: SQLitedb(CFG.REG_FILE) + if CFG.args.unapproved: + print("yes! Only unapproved ones!") + else: + print("Just approved ones") print("hi") exit(0) except KeyboardInterrupt: diff --git a/private/lib/CFG.py b/private/lib/CFG.py index b957d8a..861b052 100644 --- a/private/lib/CFG.py +++ b/private/lib/CFG.py @@ -7,9 +7,12 @@ else: if os.path.isfile(cwd) is False: cwd = os.getcwd() + "/applicationsconfig.ini" # cwd is now either cwd/applicationsconfig or $TILDE_CONF -argparser = argparse.ArgumentParser(description='interactive registration formular for tilde platforms') +argparser = argparse.ArgumentParser(description='Tilde administration tools') argparser.add_argument('-c', '--config', default=cwd, type=str, help='Path to configuration file', required=False) +# store_true just stores true when the command is supplied, so it doesn't need choices nor types +argparser.add_argument('-u', '--unapproved', default=False, action="store_true", + help='List only unapproved users', required=False) args = argparser.parse_args() CONF_FILE = args.config