Add --dir option.
authorAdam Sampson <ats@offog.org>
Sat, 20 Sep 2003 22:00:54 +0000 (22:00 +0000)
committerAdam Sampson <ats@offog.org>
Sat, 20 Sep 2003 22:00:54 +0000 (22:00 +0000)
NEWS
README
rawdoglib/rawdog.py

diff --git a/NEWS b/NEWS
index f7fd7aafbc9bb3a163583c8aef7c4336c993f83a..bfbe943fa349ec14ff579d9da13ddf776285c22b 100644 (file)
--- 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 513ec0dead3063181803a3403aca05204a6b9044..3231733232b8a3bd6d2f8489037dbe6598c899be 100644 (file)
--- 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:
index 946e8493be8f2313146979570668f7dfa5ebda44..16134116c0f8bb7cb60ad1581cd8b55af0cea7bf 100644 (file)
@@ -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 <azz@us-lot.org>."""
 
@@ -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: