# HG changeset patch # User k0s # Date 1267579645 18000 # Node ID f7f335561cebe761bcb68c7bb8a62c8c3d1d9a1e # Parent 9e4da751781569e9ddaaca2ae8f4c688268d0a50 make special usage strings for each program; again, really should abstract this diff -r 9e4da7517815 -r f7f335561ceb martini/main.py --- 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