[sysadmin-bin] print the help directly without asking the user to do so, put the mutual exclusive if statement on t



commit 9e014f53601086ea6de0edd041b7cf5ed21f28da
Author: Andrea Veri <averi redhat com>
Date:   Fri Oct 21 19:23:50 2016 +0200

    print the help directly without asking the user to do so, put the mutual exclusive if statement on top of 
main, minor fixes

 rpm-signer.py |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/rpm-signer.py b/rpm-signer.py
index 62eca26..61519ef 100755
--- a/rpm-signer.py
+++ b/rpm-signer.py
@@ -8,7 +8,7 @@ import shutil
 import sys
 from optparse import OptionParser
 
-usage = "usage: %prog -c configuration_file [-i/-l] [-i/package_name]"
+usage = "usage: %prog -c configuration_file [-i/-l] [-i package_name]"
 parser = OptionParser(usage)
 
 parser.add_option("-c", "--config-file",
@@ -30,7 +30,7 @@ parser.add_option("-l", "--list-signatures",
 config = ConfigParser.ConfigParser()
 
 if len(sys.argv) == 1:
-    print 'Not enough parameters given, try --help'
+    parser.print_help()
     sys.exit(1)
 
 if not options.config_file:
@@ -132,13 +132,14 @@ def install_package():
 
 def main():
 
+    if options.install and options.list_signatures:
+        print 'The -i and -l flags are mutually exclusive'
+        sys.exit(1)
+
     if options.install:
         install_package()
     elif options.list_signatures:
         list_rpm_files_signature()
-    elif options.install and options.list_signatures:
-        print 'The -i and -l flags are mutually exclusive'
-        sys.exit(1)
     else:
         parser.print_help()
         sys.exit(1)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]