[Pkg-privacy-commits] [mat] 47/68: refined argument exceptions

Sascha Steinbiss sascha at steinbiss.name
Sun Jan 3 12:32:42 UTC 2016


This is an automated email from the git hooks/post-receive script.

sascha-guest pushed a commit to branch master
in repository mat.

commit 7983af23b795eecea729791a113fc7a0565d3e51
Author: Muri Nicanor <muri at immerda.ch>
Date:   Wed Dec 9 21:43:39 2015 +0100

    refined argument exceptions
---
 mat | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/mat b/mat
index a9ef9a0..4b6624e 100755
--- a/mat
+++ b/mat
@@ -114,14 +114,15 @@ def list_supported():
 
 def main():
     """ Main function: get args and launch the appropriate function """
-    args = create_arg_parser()
+    argparser = create_arg_parser()
+    args = argparser.parse_args()
 
-    if len(sys.argv) < 2:  # show help when the there is no argument provided
-        args.print_help()
+    #show help if: neiter list nor file argument given; no argument at
+    #all given or the list argument mixed with some other argument given
+    if (not args.list and not args.files) or (not len(sys.argv) > 1) or (args.list and len(sys.argv) > 2):
+        argparser.print_help()
         sys.exit(2)
 
-    args = args.parse_args()
-
     # func receives the function corresponding to the options given as parameters
     if args.display:  # only print metadatas
         func = list_meta

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/mat.git



More information about the Pkg-privacy-commits mailing list