From 6e197c1353c788109df07ee6d1242a5c2327e8f9 Mon Sep 17 00:00:00 2001 From: kali Date: Wed, 1 Aug 2012 09:58:08 +0900 Subject: fileutil.which implementation --- src/leap/util/leap_argparse.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/leap/util/leap_argparse.py (limited to 'src/leap/util/leap_argparse.py') diff --git a/src/leap/util/leap_argparse.py b/src/leap/util/leap_argparse.py new file mode 100644 index 00000000..9c355134 --- /dev/null +++ b/src/leap/util/leap_argparse.py @@ -0,0 +1,20 @@ +import argparse + + +def build_parser(): + epilog = "Copyright 2012 The Leap Project" + parser = argparse.ArgumentParser(description=""" +Launches main LEAP Client""", epilog=epilog) + parser.add_argument('--debug', action="store_true", + help='launches in debug mode') + parser.add_argument('--config', metavar="CONFIG FILE", nargs='?', + action="store", dest="config_file", + type=argparse.FileType('r'), + help='optional config file') + return parser + + +def init_leapc_args(): + parser = build_parser() + opts = parser.parse_args() + return parser, opts -- cgit v1.2.3 From 813a97957572aad97d50319db96b55a74b8ed307 Mon Sep 17 00:00:00 2001 From: kali Date: Wed, 5 Sep 2012 07:54:10 +0900 Subject: can log to logfile app.py --debug --logfile /tmp/foo.log --- src/leap/util/leap_argparse.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/leap/util/leap_argparse.py') diff --git a/src/leap/util/leap_argparse.py b/src/leap/util/leap_argparse.py index 9c355134..f329cf3e 100644 --- a/src/leap/util/leap_argparse.py +++ b/src/leap/util/leap_argparse.py @@ -11,6 +11,10 @@ Launches main LEAP Client""", epilog=epilog) action="store", dest="config_file", type=argparse.FileType('r'), help='optional config file') + parser.add_argument('--logfile', metavar="LOG FILE", nargs='?', + action="store", dest="log_file", + #type=argparse.FileType('w'), + help='optional log file') return parser -- cgit v1.2.3 From 99058b9f6536a3717ab82a9d77b09d5489334eb5 Mon Sep 17 00:00:00 2001 From: kali Date: Wed, 12 Sep 2012 10:32:22 +0900 Subject: add openvpn-verb option to cli. Closes #534. accepts int [1-6] that get passed to openvpn invocation. We should filter out the polling "state"/"status" commands from the log if we want it to be real useful. --- src/leap/util/leap_argparse.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/leap/util/leap_argparse.py') diff --git a/src/leap/util/leap_argparse.py b/src/leap/util/leap_argparse.py index f329cf3e..3b38aa77 100644 --- a/src/leap/util/leap_argparse.py +++ b/src/leap/util/leap_argparse.py @@ -15,6 +15,10 @@ Launches main LEAP Client""", epilog=epilog) action="store", dest="log_file", #type=argparse.FileType('w'), help='optional log file') + parser.add_argument('--openvpn-verbosity', nargs='?', + type=int, + action="store", dest="openvpn_verb", + help='verbosity level for openvpn logs [1-6]') return parser -- cgit v1.2.3 From d1ebe98239fbc2baffa345558d396fa539e79202 Mon Sep 17 00:00:00 2001 From: kali Date: Fri, 21 Sep 2012 06:32:40 +0900 Subject: added --no-provider-checks and --no-ca-verify for ease of debugging Close #604 --- src/leap/util/leap_argparse.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/leap/util/leap_argparse.py') diff --git a/src/leap/util/leap_argparse.py b/src/leap/util/leap_argparse.py index 3b38aa77..2f996a31 100644 --- a/src/leap/util/leap_argparse.py +++ b/src/leap/util/leap_argparse.py @@ -2,12 +2,16 @@ import argparse def build_parser(): + """ + all the options for the leap arg parser + Some of these could be switched on only if debug flag is present! + """ epilog = "Copyright 2012 The Leap Project" parser = argparse.ArgumentParser(description=""" Launches main LEAP Client""", epilog=epilog) - parser.add_argument('--debug', action="store_true", + parser.add_argument('-d', '--debug', action="store_true", help='launches in debug mode') - parser.add_argument('--config', metavar="CONFIG FILE", nargs='?', + parser.add_argument('-c', '--config', metavar="CONFIG FILE", nargs='?', action="store", dest="config_file", type=argparse.FileType('r'), help='optional config file') @@ -19,6 +23,15 @@ Launches main LEAP Client""", epilog=epilog) type=int, action="store", dest="openvpn_verb", help='verbosity level for openvpn logs [1-6]') + parser.add_argument('-l', '--no-provider-checks', + action="store_true", default=False, + help="skips download of provider config files. gets " + "config from local files only. Will fail if cannot " + "find any") + parser.add_argument('-k', '--no-ca-verify', + action="store_true", default=False, + help="(insecure). Skips verification of the server " + "certificate used in TLS handshake.") return parser -- cgit v1.2.3 From 4ad663b935fa1845d426dde99a8272942b620e11 Mon Sep 17 00:00:00 2001 From: kali Date: Wed, 2 Jan 2013 18:06:13 +0900 Subject: initial OSX packaging --- src/leap/util/leap_argparse.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/leap/util/leap_argparse.py') diff --git a/src/leap/util/leap_argparse.py b/src/leap/util/leap_argparse.py index 2f996a31..5b0775cc 100644 --- a/src/leap/util/leap_argparse.py +++ b/src/leap/util/leap_argparse.py @@ -37,5 +37,5 @@ Launches main LEAP Client""", epilog=epilog) def init_leapc_args(): parser = build_parser() - opts = parser.parse_args() + opts, unknown = parser.parse_known_args() return parser, opts -- cgit v1.2.3 From 173e532c810d16bcef8f3009bc9203eed9604c87 Mon Sep 17 00:00:00 2001 From: kali Date: Wed, 30 Jan 2013 05:26:15 +0900 Subject: comment out unused arguments in the arg parser --- src/leap/util/leap_argparse.py | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) (limited to 'src/leap/util/leap_argparse.py') diff --git a/src/leap/util/leap_argparse.py b/src/leap/util/leap_argparse.py index 5b0775cc..3412a72c 100644 --- a/src/leap/util/leap_argparse.py +++ b/src/leap/util/leap_argparse.py @@ -6,16 +6,13 @@ def build_parser(): all the options for the leap arg parser Some of these could be switched on only if debug flag is present! """ - epilog = "Copyright 2012 The Leap Project" + epilog = "Copyright 2012 The LEAP Encryption Access Project" parser = argparse.ArgumentParser(description=""" -Launches main LEAP Client""", epilog=epilog) +Launches the LEAP Client""", epilog=epilog) parser.add_argument('-d', '--debug', action="store_true", - help='launches in debug mode') - parser.add_argument('-c', '--config', metavar="CONFIG FILE", nargs='?', - action="store", dest="config_file", - type=argparse.FileType('r'), - help='optional config file') - parser.add_argument('--logfile', metavar="LOG FILE", nargs='?', + help=("Launches client in debug mode, writing debug" + "info to stdout")) + parser.add_argument('-l', '--logfile', metavar="LOG FILE", nargs='?', action="store", dest="log_file", #type=argparse.FileType('w'), help='optional log file') @@ -23,15 +20,21 @@ Launches main LEAP Client""", epilog=epilog) type=int, action="store", dest="openvpn_verb", help='verbosity level for openvpn logs [1-6]') - parser.add_argument('-l', '--no-provider-checks', - action="store_true", default=False, - help="skips download of provider config files. gets " - "config from local files only. Will fail if cannot " - "find any") - parser.add_argument('-k', '--no-ca-verify', - action="store_true", default=False, - help="(insecure). Skips verification of the server " - "certificate used in TLS handshake.") + + # Not in use, we might want to reintroduce them. + #parser.add_argument('-i', '--no-provider-checks', + #action="store_true", default=False, + #help="skips download of provider config files. gets " + #"config from local files only. Will fail if cannot " + #"find any") + #parser.add_argument('-k', '--no-ca-verify', + #action="store_true", default=False, + #help="(insecure). Skips verification of the server " + #"certificate used in TLS handshake.") + #parser.add_argument('-c', '--config', metavar="CONFIG FILE", nargs='?', + #action="store", dest="config_file", + #type=argparse.FileType('r'), + #help='optional config file') return parser -- cgit v1.2.3