comparison commitwatcher/main.py @ 2:4cb3971d9d9d

commitwatcher/__init__.py commitwatcher/agent.py commitwatcher/main.py setup.py commitwatcher/commit.py commitwatcher/store.py mozbasewatcher.py
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 26 Sep 2013 21:35:29 -0700
parents bdc039cb1f2e
children
comparison
equal deleted inserted replaced
1:4e24f3c6610c 2:4cb3971d9d9d
8 import optparse 8 import optparse
9 import os 9 import os
10 import subprocess 10 import subprocess
11 import sys 11 import sys
12 12
13 from .agent import FeedAgent
14
13 def add_options(parser): 15 def add_options(parser):
14 """add options to the OptionParser instance""" 16 """add options to the OptionParser instance"""
15 17
16 def main(args=sys.argv[1:]): 18 def main(args=sys.argv[1:]):
17 19
18 # parse command line options 20 # parse command line options
19 usage = '%prog [options] ...' 21 usage = '%prog [options] url://of.repository/'
20 class PlainDescriptionFormatter(optparse.IndentedHelpFormatter): 22 class PlainDescriptionFormatter(optparse.IndentedHelpFormatter):
21 """description formatter for console script entry point""" 23 """description formatter for console script entry point"""
22 def format_description(self, description): 24 def format_description(self, description):
23 if description: 25 if description:
24 return description.strip() + '\n' 26 return description.strip() + '\n'
25 else: 27 else:
26 return '' 28 return ''
27 parser = optparse.OptionParser(usage=usage, description=__doc__, formatter=PlainDescriptionFormatter()) 29 parser = optparse.OptionParser(usage=usage, description=__doc__, formatter=PlainDescriptionFormatter())
28 options, args = parser.parse_args(args) 30 options, args = parser.parse_args(args)
31 if len(args) != 1:
32 parser.error("Please specify a single repository")
33 # TODO : multiple repos
34
35 repo = args[0]
36
37 # watch the damn thing
38 watcher = FeedAgent(repository=repo)
39 watcher.update()
29 40
30 if __name__ == '__main__': 41 if __name__ == '__main__':
31 main() 42 main()
32 43