Exemplo n.º 1
0
def usage(code, msg=''):
    if code:
        fd = sys.stderr
    else:
        fd = sys.stdout
    print >> fd, __doc__

    config = utils.parse_config(None)
    lvsshell = shell.LivePrompt(config)
    lvsshell.onecmd(' '.join(["help"]))
    print >> fd, "Use 'lvsm help <command>' for information on a specific command."

    if msg:
        print >> fd, msg
    sys.exit(code)
Exemplo n.º 2
0
def usage(code, msg=''):
    if code:
        fd = sys.stderr
    else:
        fd = sys.stdout
    print >> fd, __doc__

    config = utils.parse_config(None)
    lvsshell = shell.LivePrompt(config)
    lvsshell.onecmd(' '.join(["help"]))
    print >> fd, "Use 'lvsm help <command>' for information on a specific command."

    if msg:
        print >> fd, msg
    sys.exit(code)
Exemplo n.º 3
0
            usage(0)
        elif opt in ("-v", "--version"):
            print "lvsm " + appinfo.__version__
            sys.exit(0)
        elif opt in ("-c", "--config"):
            CONFFILE = arg
        elif opt in ("-d", "--debug"):
            logger.setLevel(logging.DEBUG)
        elif opt in ("-m", "--monochrome"):
            color = False
        elif opt in ("-n", "--numeric"):
            numeric = True

    # open config file and read it
    # config = utils.parse_config(CONFFILE)
    config = utils.parse_config(os.path.expanduser(os.path.expandvars(CONFFILE)))
    logger.debug('Parsed config file')
    logger.debug(str(config))

    try:
        lvsshell = shell.LivePrompt(config)

        if not color:
            lvsshell.do_set("color off")
        if numeric:
            lvsshell.do_set("numeric on")

        if args:
            lvsshell.onecmd(' '.join(args[:]))
        else:
            lvsshell.cmdloop()
Exemplo n.º 4
0
            usage(0)
        elif opt in ("-v", "--version"):
            print "lvsm " + appinfo.__version__
            sys.exit(0)
        elif opt in ("-c", "--config"):
            CONFFILE = arg
        elif opt in ("-d", "--debug"):
            logger.setLevel(logging.DEBUG)
        elif opt in ("-m", "--monochrome"):
            color = False
        elif opt in ("-n", "--numeric"):
            numeric = True

    # open config file and read it
    # config = utils.parse_config(CONFFILE)
    config = utils.parse_config(os.path.expanduser(os.path.expandvars(CONFFILE)))
    logger.debug('Parsed config file')
    logger.debug(str(config))

    try:
        lvsshell = shell.LivePrompt(config)

        if not color:
            lvsshell.do_set("color off")
        if numeric:
            lvsshell.do_set("numeric on")

        if args:
            lvsshell.onecmd(' '.join(args[:]))
        else:
            lvsshell.cmdloop()