command line arguments to select action

This commit is contained in:
Ronald Schaten 2010-10-31 19:46:13 +01:00
parent 64c3506a9e
commit a00e703068

View File

@ -10,6 +10,7 @@ import sys
import urllib import urllib
import hn import hn
import html2text import html2text
from optparse import OptionParser
Base = declarative_base() Base = declarative_base()
@ -246,8 +247,17 @@ def fetch_all_feeds():
print print
if __name__ == '__main__': if __name__ == '__main__':
fetch_all_feeds() parser = OptionParser()
mail_single_entries() parser.add_option("-f", "--fetch", action="store_true", dest="fetch", default=False, help="fetch all feeds")
#mail_daily_digest() parser.add_option("-s", "--single", action="store_true", dest="single", default=False, help="send single mails")
parser.add_option("-d", "--daily", action="store_true", dest="daily", default=False, help="send daily digest")
(options, args) = parser.parse_args()
if options.fetch:
fetch_all_feeds()
if options.single:
mail_single_entries()
if options.daily:
mail_daily_digest()
session.commit() session.commit()