Fix and allow the specification of the selector base. - gopher-lawn - The gopher lawn gopher directory project.
 (HTM) git clone git://bitreich.org/gopher-lawn/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/gopher-lawn/
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) Tags
       ---
 (DIR) commit 70256704e7826dfb2f619ef9615d28b86d54445c
 (DIR) parent e1e3d7b8ef80c362849ca076316b02cae4919e5c
 (HTM) Author: Christoph Lohmann <20h@r-36.net>
       Date:   Fri, 28 Aug 2020 13:32:08 +0200
       
       Fix and allow the specification of the selector base.
       
       Diffstat:
         M lawn-mower/lawn-mower.py            |      13 +++++++++----
       
       1 file changed, 9 insertions(+), 4 deletions(-)
       ---
 (DIR) diff --git a/lawn-mower/lawn-mower.py b/lawn-mower/lawn-mower.py
       @@ -12,19 +12,21 @@ import getopt
        
        def usage(app):
                app = os.path.basename(app)
       -        print("usage: %s [-h] [-c categorydir] [-b basedir]" \
       +        print("usage: %s [-h] [-b basedir] [-c categorydir] " \
       +              "[-s selectorbase]" \
                        % (app), file=sys.stderr)
                sys.exit(1)
        
        def main(args):
                try:
       -                opts, largs = getopt.getopt(args[1:], "hc:")
       +                opts, largs = getopt.getopt(args[1:], "hc:s:")
                except getopt.GetoptError as err:
                        print(str(err))
                        usage(args[0])
        
                basedir = "./"
                categorysubdir = "/c"
       +        selectorbase = "/lawn"
                for o, a in opts:
                        if o == "-h":
                                usage(args[0])
       @@ -32,10 +34,13 @@ def main(args):
                                basedir = a
                        elif o == "-c":
                                categorysubdir = a
       +                elif o == "-s":
       +                        selectorbase = a
                        else:
                                assert False, "unhandled option"
        
                categorydir = "%s%s" % (basedir, categorysubdir)
       +        categoryselector = "%s%s" % (selectorbase, categorysubdir)
        
                filelist = largs
                if len(largs) == 0:
       @@ -270,9 +275,9 @@ def main(args):
                        tmplfd.close()
                        outfd.close()
        
       -        mkcategory(rootcategory, basedir, categorysubdir, "index.gph.tmpl")
       +        mkcategory(rootcategory, basedir, categoryselector, "index.gph.tmpl")
                for c in categories.keys():
       -                mkcategory(categories[c], categorydir, categorysubdir,\
       +                mkcategory(categories[c], categorydir, categoryselector,\
                                "category.gph.tmpl")
                return 0