changeset 4:f7f335561ceb

make special usage strings for each program; again, really should abstract this
author k0s <k0scist@gmail.com>
date Tue, 02 Mar 2010 20:27:25 -0500
parents 9e4da7517815
children 13d85b455533
files martini/main.py
diffstat 1 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/martini/main.py	Tue Mar 02 20:18:15 2010 -0500
+++ b/martini/main.py	Tue Mar 02 20:27:25 2010 -0500
@@ -1,7 +1,5 @@
 #!/usr/bin/env python
 
-usage = "%s file1 [file2] [...] --section1 option1=value1 option2=value2 --section2 option3=value3"
-
 import config
 import os
 import sys
@@ -53,6 +51,8 @@
     return (files, ini)
 
 def set(args=None):
+
+    usage = "%s file1 [file2] [...] --section1 option1=value1 option2=value2 --section2 option3=value3"
     
     # process arguments
     if args is None:
@@ -62,7 +62,7 @@
     # display usage information
     if not files:
         print 'Usage:'
-        print usage % sys.argv[0]
+        print usage % os.path.basename(sys.argv[0])
         sys.exit(0)
 
     # process the files
@@ -82,6 +82,8 @@
        
 def get(args=None):
 
+    usage = "%s file1 [file2] [...] --section1 option1 option2 --section2 option3"
+
     # process arguments
     if args is None:
         args = sys.argv[1:]
@@ -90,7 +92,7 @@
     # display usage information
     if not files:
         print 'Usage:'
-        print usage % sys.argv[0]
+        print usage % os.path.basename(sys.argv[0])
         sys.exit(0)
 
     # process the files
@@ -112,6 +114,8 @@
 
 def delete(args=None):
 
+    usage = "%s file1 [file2] [...] --section1 option1 option2 --section2 option3"
+
     # process arguments
     if args is None:
         args = sys.argv[1:]
@@ -120,7 +124,7 @@
     # display usage information
     if not files:
         print 'Usage:'
-        print usage % sys.argv[0]
+        print usage % os.path.basename(sys.argv[0])
         sys.exit(0)
 
     # process the files
@@ -147,6 +151,8 @@
 
 def munge(args=None):
 
+    usage = "%s file1 [file2] [...]"
+
     # process arguments
     if args is None:
         args = sys.argv[1:]
@@ -160,7 +166,7 @@
     # display usage information
     if not files:
         print 'Usage:'
-        print usage % sys.argv[0]
+        print usage % os.path.basename(sys.argv[0])
         sys.exit(0)
 
     # munge the files