From 61379c482c2cdfc1180d31b1726bd12b3690b1b6 Mon Sep 17 00:00:00 2001 From: Adam Sampson Date: Sat, 20 Sep 2003 22:00:54 +0000 Subject: [PATCH] Add --dir option. --- NEWS | 3 +++ README | 13 +++++++++++-- rawdoglib/rawdog.py | 14 +++++++++----- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index f7fd7aa..bfbe943 100644 --- a/NEWS +++ b/NEWS @@ -28,6 +28,9 @@ Added --show-template option to show the template currently in use (so you can customise it yourself), and "template" config option to allow the user to specify their own template. +Added --dir option for people who want two lots of rawdog state (for two +sets of feeds, for instance). + - rawdog 1.2 Updated feedparser to 2.5.2, which fixes a bug that was making rawdog diff --git a/README b/README index 513ec0d..3231733 100644 --- a/README +++ b/README @@ -34,8 +34,6 @@ to perform -- for instance, "rawdog --update --write" tells it to do the "--update" action, then the "--write" action. The actions supported are as follows: -"--help": Provide a brief summary of all the options rawdog supports. - "--update" (or "-u"): Fetch data from the feeds and store it. This could take some time if you've got lots of feeds. @@ -64,6 +62,17 @@ own template: do "rawdog -t >~/.rawdog/mytemplate" with "template default" in your config file, and you'll get a copy of the default template to edit. +There are also the following options which may only be supplied once +(they're read before any of the actions are performed): + +"--help": Provide a brief summary of all the options rawdog supports, +and exit. + +"--dir DIR" (or "-d DIR"), where DIR is a directory: Use DIR instead of +the $HOME/.rawdog directory. This is useful if you want to have two or +more completely different rawdog setups with different sets of feeds; +just create a directory for each. + You will want to run "rawdog -uw" periodically to fetch data and write the output file. The easiest way to do this is to add a crontab entry that looks something like this: diff --git a/rawdoglib/rawdog.py b/rawdoglib/rawdog.py index 946e849..1613411 100644 --- a/rawdoglib/rawdog.py +++ b/rawdoglib/rawdog.py @@ -502,15 +502,17 @@ def usage(): print """rawdog, version """ + VERSION + """ Usage: rawdog [OPTION]... +General options (use only once): +-d|--dir DIR Use DIR instead of ~/.rawdog +--help Display this help and exit + +Actions (performed in order given): -u, --update Fetch data from feeds and store it -l, --list List feeds known at time of last update -w, --write Write out HTML output -f|--update-feed URL Force an update on the single feed URL -c|--config FILE Read additional config file FILE -t, --show-template Print the template currently in use ---help Display this help and exit - -Actions are taken in the order they are given on the command line. Report bugs to .""" @@ -518,16 +520,19 @@ def main(argv): """The command-line interface to the aggregator.""" try: - (optlist, args) = getopt.getopt(argv, "ulwf:c:t", ["update", "list", "write", "update-feed=", "help", "config=", "show-template"]) + (optlist, args) = getopt.getopt(argv, "ulwf:c:td:", ["update", "list", "write", "update-feed=", "help", "config=", "show-template", "dir"]) except getopt.GetoptError, s: print s usage() return 1 + statedir = os.environ["HOME"] + "/.rawdog" for o, a in optlist: if o == "--help": usage() return 0 + elif o in ("-d", "--dir"): + statedir = a # Support old option syntax. for action in args: @@ -536,7 +541,6 @@ def main(argv): else: optlist.append(("update-feed", action)) - statedir = os.environ["HOME"] + "/.rawdog" try: os.chdir(statedir) except OSError: -- 2.35.1