Skip to content
Browse files

make sure a url is passed as an argument

  • Loading branch information...
1 parent 756fe27 commit 58fcb59865d3b1885d0b8c8ebc0f12bfd328c63f @cwarden cwarden committed Dec 22, 2010
Showing with 7 additions and 2 deletions.
  1. +7 −2 gitmark.py
View
9 gitmark.py
@@ -28,7 +28,12 @@ class gitMark(object):
def __init__(self, options, args):
modified = [] # track files we need to add - a hack, because it will add files that are already tracked by git
- url = args[0].strip('/')
+ try:
+ url = args[0].strip('/')
+ except IndexError, e:
+ print >>sys.stderr, ("Error: No url found")
+ return
+
content = self.getContent(url)
title = self.parseTitle(content)
content_filename = self.generateHash(url)
@@ -116,7 +121,7 @@ def getContent(self, url):
if __name__ == '__main__':
- parser = OptionParser("usage: %prog [options]")
+ parser = OptionParser("usage: %prog [options] <url>")
parser.add_option("-p", "--push", dest="push", action="store_false", default=True, help="don't push to origin.")
parser.add_option("-t", "--tags", dest="tags", action="store", default='notag', help="comma seperated list of tags")
parser.add_option("-m", "--message", dest="msg", action="store", default=None, help="specify a commit message (default is 'adding [url]')")

0 comments on commit 58fcb59

Please sign in to comment.
Something went wrong with that request. Please try again.