#!/usr/bin/env python
"""
Script SIMPLEBLOG-RUN
Wrapper script for package SIMPLEBLOG
Copyright (C) 2012 by Peter A. Donis

Released under the GNU General Public License, Version 2
See the LICENSE and README files for more information
"""


global_optlist = (
    ("-c", "--configfile",
        { 'help': "the configuration file name" }
    ),
    ("-b", "--blogfile",
        { 'help': "the blog metadata file name" }
    )
)

global_arglist = (
    ("command", { 'nargs': "?", 'default': "" }),
)


if __name__ == '__main__':
    from plib.stdlib.options import parse_options
    
    opts, args, result, remaining = parse_options(
        global_optlist, global_arglist,
        incremental=True
    )
    
    cmd = args.command
    if cmd:
        from simpleblog.run import run
        run(cmd, opts, result, remaining)
    else:
        from simpleblog import *
        from plib.stdlib.cmdline import run_shell
        run_shell()
