Browse files

Created custom help output with optparse. Added a check for args (wit…

…h an error message) before running the parser.
  • Loading branch information...
1 parent b16ac55 commit d88a504334829b9daf2f9667d5e22f9c86be6f34 Wieschie committed Sep 9, 2013
Showing with 5 additions and 2 deletions.
  1. +5 −2 bin/skadi
View
7 bin/skadi
@@ -11,10 +11,13 @@ sys.path.append(root)
from skadi import demo as d
-
-option_parser = optparse.OptionParser()
+usage = "skadi [FILE] \n\nExample: 'bin/%prog tests/data/test.dem'"
+option_parser = optparse.OptionParser(usage = usage)
(options, args) = option_parser.parse_args()
+if len(args) < 1:
+ print "No arguments provided. Run skadi -h for example usage."
+
for abspath in args:
print 'opening {0}...'.format(os.path.basename(abspath))

0 comments on commit d88a504

Please sign in to comment.