scripts/search-index
changeset 106 0690d715385d
parent 105 e24da9a94ffb
child 121 86aebc9cb60b
--- a/scripts/search-index	Wed Feb 11 04:41:22 2009 +0200
+++ b/scripts/search-index	Wed Feb 11 04:57:55 2009 +0200
@@ -311,7 +311,7 @@
         if not options.quiet :
             print "Channel %s:" % channel.id
 
-        # no 'after' by default
+        # no 'from' by default
         after = None
 
         # path to our state file
@@ -336,11 +336,8 @@
                 # parse timestamp
                 after = utils.from_utc_timestamp(int(after_str))
 
-                # one day backwards
-                after = after.replace(day=after.day - 1)
-
                 if not options.quiet :
-                    print "\tContinuing earlier progress: after=%s" % after
+                    print "\tContinuing earlier progress from %s" % after
 
             else :
                 # ignore
@@ -384,18 +381,18 @@
                 after = options.after
                
                 if not options.quiet :
-                    print "\tOnly including dates after %s" % after
+                    print "\tOnly including dates from %s onwards" % after
             
             else :
                 if not options.quiet :
-                    print "\t[WARN] Ignoring --after because we found a tempfile"
+                    print "\t[WARN] Ignoring --from because we found a tempfile"
             
         # only up to some specific date?
         if options.until :
             until = options.until
 
             if not options.quiet :
-                print "\tOnly including dates up to %s" % until
+                print "\tOnly including dates up to (and including) %s" % until
         else :
             # default to now
             until = None
@@ -546,30 +543,58 @@
         option_class    = MyOption,
     )
 
-    # define command-line arguments
+    # general options       #                   #                       #                                   #
     general = optparse.OptionGroup(parser, "General Options")
-    general.add_option('-h', "--help",           dest="help",            help="Show this help message and exit",     action="store_true"    )
-    general.add_option(      "--formatter",      dest="formatter_name",  help="LogFormatter to use",                 metavar="FMT",  type="choice", default="irssi",
-        choices=[fmt_name for fmt_name in config.LOG_FORMATTERS.iterkeys()])
+    general.add_option('-h', "--help",          dest="help",            help="Show this help message and exit",     
+                                                action="store_true"                                         )
 
-    general.add_option(      "--index",          dest="index_path",      help="Index database path",                 metavar="PATH", default="logs/index"               )
-    general.add_option(      "--timezone",       dest="timezone",        help="Timezone for output",                 metavar="TZ",   type="timezone", default=pytz.utc  )
-    general.add_option(      "--force",          dest="force",           help="Force dangerous operation",           action="store_true"    )
-    general.add_option(      "--quiet",          dest="quiet",           help="Supress status messages",             action="store_true"    )
+    general.add_option(     "--formatter",      dest="formatter_name",  help="LogFormatter to use",                 
+            metavar="FMT",  type="choice",                              default="irssi",
+            choices=[fmt_name for fmt_name in config.LOG_FORMATTERS.iterkeys()]                             )
+
+    general.add_option(     "--index",          dest="index_path",      help="Index database path",                 
+            metavar="PATH",                                             default="logs/index"                )
+
+    general.add_option(     "--timezone",       dest="timezone",        help="Timezone for output",                 
+            metavar="TZ",   type="timezone",                            default=pytz.utc                    )
+
+    general.add_option(     "--force",          dest="force",           help="Force dangerous operation",           
+                                                action="store_true"                                         )
+
+    general.add_option(     "--quiet",          dest="quiet",           help="Supress status messages",             
+                                                action="store_true"                                         )
     parser.add_option_group(general)
     
+
+    # cmd_load options      #                   #                       #                                   #
     load = optparse.OptionGroup(parser, "Load Options")
-    load.add_option(      "--skip-missing",   dest="skip_missing",    help="Skip missing logfiles",               action="store_true"       )
-    load.add_option(      "--create",         dest="create",          help="Create index database",               action="store_true"       )
+    load.add_option(        "--skip-missing",   dest="skip_missing",    help="Skip missing logfiles",
+                                                action="store_true"                                         )
+
+    load.add_option(        "--create",         dest="create",          help="Create index database", 
+                                                action="store_true"                                         )
     parser.add_option_group(load)
     
+
+    # cmd_autoload options  #                   #                       #                                   #
     autoload = optparse.OptionGroup(parser, "Autoload Options")
-    autoload.add_option(      "--autoload-state", dest="autoload_state_path", help="Path to autoload state dir",      metavar="PATH", default="logs/autoload-state"   )
-    autoload.add_option(      "--after",          dest="after",           help="Only autoload logfiles after the given date", metavar="DATE", type="date", action="parse_date", default=None )
-    autoload.add_option(      "--until",          dest="until",           help="Only autoload logfiles up to the given date", metavar="DATE", type="date", action="parse_date", default=None )
-    autoload.add_option(      "--reload",         dest="reload",          help="Force reload lines",                  action="store_true"   )
-    autoload.add_option(      "--reset",          dest="reset",           help="Reset old autload state",             action="store_true"   )
-    autoload.add_option(      "--ignore-resume",  dest="ignore_resume",   help="Do not try and resume interrupted autoload",  action="store_true" )
+    autoload.add_option(    "--autoload-state", dest="autoload_state_path", help="Path to autoload state dir",      
+            metavar="PATH",                                             default="logs/autoload-state"       )
+
+    autoload.add_option(    "--from",           dest="after",           help="Only autoload logfiles from the given date on", 
+            metavar="DATE", type="date",        action="parse_date",    default=None                        )
+
+    autoload.add_option(    "--until",          dest="until",           help="Only autoload logfiles up to (and including) the given date",  
+            metavar="DATE", type="date",        action="parse_date",    default=None                        )
+
+    autoload.add_option(    "--reload",         dest="reload",          help="Force reload lines",
+                                                action="store_true"                                         )
+
+    autoload.add_option(    "--reset",          dest="reset",           help="Reset old autload state",
+                                                action="store_true"                                         )
+
+    autoload.add_option(    "--ignore-resume",  dest="ignore_resume",   help="Do not try and resume interrupted autoload",  
+                                                action="store_true"                                         )
     parser.add_option_group(autoload)
 
     # parse