示例#1
0
def tx_main_parser():
    description = "This is the Transifex command line client which"\
                  " allows you to manage your translations locally and sync"\
                  " them with the master Transifex server.\nIf you'd like to"\
                  " check the available commands issue `%(prog)s help` or if"\
                  " you just want help with a specific command issue"\
                  " `%(prog)s help command`"
    version = get_version()
    parser = ArgumentParser(description=description, add_help=False)
    # parser.disable_interspersed_args()
    parser.add_argument('--version', action='version', version=version)
    parser.add_argument("-d",
                        "--debug",
                        action="store_true",
                        dest="debug",
                        default=False,
                        help=("enable debug messages"))
    parser.add_argument("-q",
                        "--quiet",
                        action="store_true",
                        dest="quiet",
                        default=False,
                        help="don't print status messages to stdout")
    parser.add_argument("--root",
                        action="store",
                        dest="root_dir",
                        type=str,
                        default=None,
                        help="change root directory (default is cwd)")
    parser.add_argument("--traceback",
                        action="store_true",
                        dest="trace",
                        default=False,
                        help="print full traceback on exceptions")
    parser.add_argument("--disable-colors",
                        action="store_true",
                        dest="color_disable",
                        default=(os.name == 'nt' or not sys.stdout.isatty()),
                        help="disable colors in the output of commands")
    # set a private CA cert bundle file to override the system one
    parser.add_argument("--cacert",
                        action="store",
                        dest="cacert",
                        default=None,
                        help="set path to CA certificate bundle file",
                        metavar='/path/to/ca-cert-bundle-file',
                        type=check_file_exists)
    parser.add_argument("command",
                        action="store",
                        help="TX command",
                        nargs='?',
                        default=None)
    return parser
示例#2
0
def tx_main_parser():
    description = "This is the Transifex command line client which"\
                  " allows you to manage your translations locally and sync"\
                  " them with the master Transifex server.\nIf you'd like to"\
                  " check the available commands issue `%(prog)s help` or if"\
                  " you just want help with a specific command issue"\
                  " `%(prog)s help command`"
    version = get_version()
    parser = ArgumentParser(
        description=description, add_help=False
    )
    # parser.disable_interspersed_args()
    parser.add_argument('--version', action='version', version=version)
    parser.add_argument(
        "-d", "--debug", action="store_true", dest="debug",
        default=False, help=("enable debug messages")
    )
    parser.add_argument(
        "-q", "--quiet", action="store_true", dest="quiet",
        default=False, help="don't print status messages to stdout"
    )
    parser.add_argument(
        "--root", action="store", dest="root_dir", type=str,
        default=None, help="change root directory (default is cwd)"
    )
    parser.add_argument(
        "--traceback", action="store_true", dest="trace", default=False,
        help="print full traceback on exceptions"
    )
    parser.add_argument(
        "--disable-colors", action="store_true", dest="color_disable",
        default=(os.name == 'nt' or not sys.stdout.isatty()),
        help="disable colors in the output of commands"
    )
    parser.add_argument(
        "command", action="store", help="TX command", nargs='?', default=None
    )
    return parser