command line arguments to select action
This commit is contained in:
parent
64c3506a9e
commit
a00e703068
12
atomstrom.py
12
atomstrom.py
@ -10,6 +10,7 @@ import sys
|
||||
import urllib
|
||||
import hn
|
||||
import html2text
|
||||
from optparse import OptionParser
|
||||
|
||||
Base = declarative_base()
|
||||
|
||||
@ -246,8 +247,17 @@ def fetch_all_feeds():
|
||||
print
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = OptionParser()
|
||||
parser.add_option("-f", "--fetch", action="store_true", dest="fetch", default=False, help="fetch all feeds")
|
||||
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()
|
||||
#mail_daily_digest()
|
||||
if options.daily:
|
||||
mail_daily_digest()
|
||||
|
||||
session.commit()
|
||||
|
Loading…
Reference in New Issue
Block a user