def setupParser(parser):
    parser.add_argument(
        'title',
        type=str,
        help="Title of the paste.")

    text_arg_group = parser.add_mutually_exclusive_group(required=True)

    text_arg_group.add_argument(
        '--text', "-t",
        type=str,
        default="",
        help="Text of the paste.")
    text_arg_group.add_argument(
        '--text-file', "-f",
        metavar='FILENAME',
        type=argparse.FileType('r'),
        help="a file to read the paste from, use '-' to specify stdin")

    parser.add_argument(
        '--language', '-l',
        metavar="LANGUAGE",
        type=str,
        default=None,
        help="The language of the paste ie. C++, java etc. default detects"
        "from filename in title."
    )

    parser.add_argument(
        '--format-id', '--id',
        action="store_true",
        dest="format_id",
        help="only print the ID of the paste")

    phlsys_makeconduit.add_argparse_arguments(parser)
def setupParser(parser):
    filters = parser.add_argument_group('filter parameters')
    self_filters = parser.add_argument_group('self filter parameters')
    user_filters = parser.add_argument_group('user filter parameters')
    time_filters = parser.add_argument_group(
        'time filter parameters',
        textwrap.fill(
            phlsys_strtotime.describe_duration_string_to_time_delta()))
    fmts = parser.add_argument_group('output format parameters',
                                     'choose one only, default is "short"')
    formats = fmts.add_mutually_exclusive_group()

    _setupParserTopLevel(parser)
    _setupParserFilters(filters, self_filters, user_filters, time_filters)

    formats.add_argument('--format-type',
                         choices=['ids', 'short', 'python', 'json'],
                         help="see usage examples for sample output")
    formats.add_argument(
        '--format-string',
        metavar='FORMAT',
        type=str,
        help="compose your own output format, e.g. '$id $title', see "
        "usage examples for more details")

    phlsys_makeconduit.add_argparse_arguments(parser)
def setupParser(parser):
    parser.add_argument('title', type=str, help="Title of the paste.")

    text_arg_group = parser.add_mutually_exclusive_group(required=True)

    text_arg_group.add_argument('--text',
                                "-t",
                                type=str,
                                default="",
                                help="Text of the paste.")
    text_arg_group.add_argument(
        '--text-file',
        "-f",
        metavar='FILENAME',
        type=argparse.FileType('r'),
        help="a file to read the paste from, use '-' to specify stdin")

    parser.add_argument(
        '--language',
        '-l',
        metavar="LANGUAGE",
        type=str,
        default=None,
        help="The language of the paste ie. C++, java etc. default detects"
        "from filename in title.")

    parser.add_argument('--format-id',
                        '--id',
                        action="store_true",
                        dest="format_id",
                        help="only print the ID of the paste")

    phlsys_makeconduit.add_argparse_arguments(parser)
def setupParser(parser):
    filters = parser.add_argument_group('filter parameters')
    self_filters = parser.add_argument_group('self filter parameters')
    user_filters = parser.add_argument_group('user filter parameters')
    time_filters = parser.add_argument_group(
        'time filter parameters',
        textwrap.fill(
            phlsys_strtotime.describe_duration_string_to_time_delta()))
    fmts = parser.add_argument_group(
        'output format parameters', 'choose one only, default is "short"')
    formats = fmts.add_mutually_exclusive_group()

    _setupParserTopLevel(parser)
    _setupParserFilters(filters, self_filters, user_filters, time_filters)

    formats.add_argument(
        '--format-type',
        choices=['ids', 'short', 'python', 'json'],
        help="see usage examples for sample output")
    formats.add_argument(
        '--format-string',
        metavar='FORMAT',
        type=str,
        help="compose your own output format, e.g. '$id $title', see "
                "usage examples for more details")

    phlsys_makeconduit.add_argparse_arguments(parser)
def parse_args():
    parser = argparse.ArgumentParser(
        formatter_class=argparse.RawDescriptionHelpFormatter,
        description=__doc__,
        epilog=_USAGE_EXAMPLES)

    parser.add_argument(
        '--ids', '-i',
        type=int,
        nargs='*',
        help='list of ids to linterate')

    parser.add_argument(
        '--silent',
        action="store_true",
        help='whether to print anything other than errors')

    parser.add_argument(
        '--non-interactive',
        action="store_true",
        help='suppress prompts for the user, take no action')

    phlsys_makeconduit.add_argparse_arguments(parser)

    args = parser.parse_args()

    return args
Exemple #6
0
def parse_args():
    parser = argparse.ArgumentParser(
        formatter_class=argparse.RawDescriptionHelpFormatter,
        description=__doc__,
        epilog=_USAGE_EXAMPLES)

    parser.add_argument('--ids',
                        '-i',
                        type=int,
                        nargs='*',
                        help='list of ids to linterate')

    parser.add_argument('--silent',
                        action="store_true",
                        help='whether to print anything other than errors')

    parser.add_argument('--non-interactive',
                        action="store_true",
                        help='suppress prompts for the user, take no action')

    phlsys_makeconduit.add_argparse_arguments(parser)

    args = parser.parse_args()

    return args
Exemple #7
0
def main():
    parser = argparse.ArgumentParser(
        formatter_class=argparse.RawDescriptionHelpFormatter,
        description=__doc__,
        epilog=_USAGE_EXAMPLES)

    phlsys_makeconduit.add_argparse_arguments(parser)

    parser.add_argument('--sslcert',
                        metavar="SSLCERT",
                        help="certificate to use if you want https")

    parser.add_argument('--port',
                        metavar="PORT",
                        type=int,
                        default=8000,
                        help="port to serve the conduit on")

    parser.add_argument('--secret',
                        metavar="STRING",
                        required=True,
                        help="the magic word used to gain access")

    args = parser.parse_args()

    _setup_logging()
    _httpd_serve_forever(args)
def setupParser(parser):
    actions = parser.add_argument_group(
        "action arguments", "use any of " + textwrap.fill(str(phlcon_differential.USER_ACTIONS.keys()))
    )

    parser.add_argument("ids", type=int, nargs="*", default=[], help="the revisions to comment on (e.g. 1)")
    parser.add_argument(
        "--ids-file",
        metavar="FILE",
        type=argparse.FileType("r"),
        help="a file to read ids from, use '-' to specify stdin",
    )

    parser.add_argument("--message", "-m", metavar="M", default="", type=str, help="the body text of the comment")
    parser.add_argument(
        "--message-file",
        metavar="FILE",
        type=argparse.FileType("r"),
        help="a file to read the message from, use '-' for stdin",
    )
    parser.add_argument("--silent", action="store_true", help="don't send notification emails for this comment")

    actions.add_argument(
        "--action",
        "-a",
        choices=phlcon_differential.USER_ACTIONS.keys(),
        metavar="ACTION",
        default="comment",
        type=str,
        help="perform an action on a review",
    )

    phlsys_makeconduit.add_argparse_arguments(parser)
def main():
    parser = argparse.ArgumentParser(
        formatter_class=argparse.RawDescriptionHelpFormatter,
        description=__doc__,
        epilog=_USAGE_EXAMPLES)

    phlsys_makeconduit.add_argparse_arguments(parser)

    parser.add_argument(
        '--sslcert',
        metavar="SSLCERT",
        help="certificate to use if you want https")

    parser.add_argument(
        '--port',
        metavar="PORT",
        type=int,
        default=8000,
        help="port to serve the conduit on")

    parser.add_argument(
        '--secret',
        metavar="STRING",
        required=True,
        help="the magic word used to gain access")

    args = parser.parse_args()

    _setup_logging()
    _httpd_serve_forever(args)
def setupParser(parser):
    diffsrc_group = parser.add_argument_group("Diff arguments", "Mutually exclusive, one is required")
    diffsrc = diffsrc_group.add_mutually_exclusive_group(required=True)
    req = parser.add_argument_group("Required revision arguments", "Phabricator requires that you supply both of these")
    opt = parser.add_argument_group(
        "Optional revision arguments", "You can supply these later via the web interface if you wish"
    )
    output_group = parser.add_argument_group(
        "Output format arguments", 'Mutually exclusive, defaults to "--format-summary"'
    )
    output = output_group.add_mutually_exclusive_group()

    diffsrc.add_argument(
        "--diff-id",
        metavar="INT",
        help="the id of the diff to create the file from, this could be " 'the output from a "arcyon raw-diff" call',
        type=int,
    )
    diffsrc.add_argument(
        "--raw-diff-file",
        "-f",
        help="the file to read the diff from, use '-' for stdin",
        metavar="FILE",
        type=argparse.FileType("r"),
    )

    req.add_argument(
        "--title", "-t", metavar="TEXT", required=True, help="a short description of the changes to review", type=str
    )
    req.add_argument(
        "--test-plan",
        "-p",
        metavar="TEXT",
        required=True,
        help="how you tested your changes and how the reviewer" "can verify them",
        type=str,
    )

    opt.add_argument("--summary", "-s", metavar="TEXT", help="a longer summary of the changes to review", type=str)
    opt.add_argument("--reviewers", "-r", nargs="*", metavar="USER", help="a list of reviewer usernames", type=str)
    opt.add_argument("--ccs", "-c", nargs="*", metavar="USER", help="a list of usernames to cc on the review", type=str)

    output.add_argument(
        "--format-summary", action="store_true", help="will print a human-readable summary of the result."
    )
    output.add_argument(
        "--format-id", action="store_true", help="will print just the id of the new revision, for scripting."
    )
    output.add_argument(
        "--format-url", action="store_true", help="will print just the url of the new revision, for scripting."
    )

    #   parser.add_argument(
    #       '--deps', '--depends-on',
    #       nargs="*",
    #       metavar='ID',
    #       type=int)

    phlsys_makeconduit.add_argparse_arguments(parser)
def setupParser(parser):
    parser.add_argument(
        'infile',
        metavar='INFILE',
        nargs='?',
        type=argparse.FileType('r'),
        help="where to read the diff from, can be filename or '-' for stdin. "
             "default is stdin if not specified.",
        default=sys.stdin)
    phlsys_makeconduit.add_argparse_arguments(parser)
def setupParser(parser):
    parser.add_argument(
        'infile',
        metavar='INFILE',
        nargs='?',
        type=argparse.FileType('r'),
        help="where to read the diff from, can be filename or '-' for stdin. "
        "default is stdin if not specified.",
        default=sys.stdin)
    phlsys_makeconduit.add_argparse_arguments(parser)
def setupParser(parser):

    # make a list of priority names in increasing order of importance
    priority_name_list = phlcon_maniphest.PRIORITIES.keys()
    priority_name_list.sort(key=lambda x: phlcon_maniphest.PRIORITIES[x])

    priorities = parser.add_argument_group(
        "optional priority arguments", "use any of " + textwrap.fill(str(priority_name_list))
    )
    output_group = parser.add_argument_group(
        "Output format arguments", 'Mutually exclusive, defaults to "--format-summary"'
    )
    output = output_group.add_mutually_exclusive_group()
    opt = parser.add_argument_group(
        "Optional task arguments", "You can supply these later via the web interface if you wish"
    )

    priorities.add_argument(
        "--priority",
        "-p",
        choices=priority_name_list,
        metavar="PRIORITY",
        default=None,
        type=str,
        help="the priority or importance of the task",
    )

    parser.add_argument("title", metavar="STRING", help="the short title of the task", type=str)

    opt.add_argument("--description", "-d", metavar="STRING", help="the long description of the task", type=str)
    opt.add_argument("--owner", "-o", metavar="USER", help="the username of the owner", type=str)
    opt.add_argument(
        "--ccs", "-c", nargs="*", metavar="USER", default=[], help="a list of usernames to cc on the task", type=str
    )
    opt.add_argument(
        "--projects",
        nargs="*",
        metavar="PROJECT",
        default=[],
        help="a list of project names to add the task to",
        type=str,
    )

    output.add_argument(
        "--format-summary", action="store_true", help="will print a human-readable summary of the result."
    )
    output.add_argument(
        "--format-id", action="store_true", help="will print just the id of the new task, for scripting."
    )
    output.add_argument(
        "--format-url", action="store_true", help="will print just the url of the new task, for scripting."
    )

    phlsys_makeconduit.add_argparse_arguments(parser)
def setupParser(parser):
    actions = parser.add_argument_group(
        'action arguments',
        'use any of ' + textwrap.fill(
            str(phlcon_differential.USER_ACTIONS.keys())))

    parser.add_argument(
        'ids',
        type=int,
        nargs="*",
        default=[],
        help="the revisions to comment on (e.g. 1)")
    parser.add_argument(
        '--ids-file',
        metavar='FILE',
        type=argparse.FileType('r'),
        help="a file to read ids from, use '-' to specify stdin")

    parser.add_argument(
        '--message', '-m',
        metavar="M",
        default="",
        type=str,
        help="the body text of the comment")
    parser.add_argument(
        '--message-file',
        metavar='FILE',
        type=argparse.FileType('r'),
        help="a file to read the message from, use '-' for stdin")
    parser.add_argument(
        '--silent',
        action='store_true',
        help="don't send notification emails for this comment")

    actions.add_argument(
        '--action', '-a',
        choices=phlcon_differential.USER_ACTIONS.keys(),
        metavar="ACTION",
        default='comment',
        type=str,
        help="perform an action on a review")

    parser.add_argument(
        '--act-as-user',
        type=str,
        metavar="NAME",
        help="impersonate a user (admin only)")

    phlsys_makeconduit.add_argparse_arguments(parser)
def setupParser(parser):
    diffsrc_group = parser.add_argument_group(
        'Diff arguments',
        'Mutually exclusive, one is required')
    diffsrc = diffsrc_group.add_mutually_exclusive_group(required=True)
    output_group = parser.add_argument_group(
        'Output format arguments',
        'Mutually exclusive, defaults to "--format-summary"')
    output = output_group.add_mutually_exclusive_group()

    diffsrc.add_argument(
        '--diff-id',
        metavar='INT',
        help='the id of the diff to create the file from, this could be '
             'the output from a "arcyon raw-diff" call',
        type=int)
    diffsrc.add_argument(
        '--raw-diff-file',
        '-f',
        help='the file to read the diff from, use \'-\' for stdin',
        metavar='FILE',
        type=argparse.FileType('r'))

    parser.add_argument(
        'revision_id',
        help='the id of the revision to update, e.g. the output from a '
             'previous "arcyon create-revision" command',
        type=str)

    parser.add_argument(
        'message',
        help='a short description of the update, this appears on the review '
             'page',
        type=str)

    output.add_argument(
        '--format-summary',
        action='store_true',
        help='will print a human-readable summary of the result.')
    output.add_argument(
        '--format-id',
        action='store_true',
        help='will print just the id of the revision, for scripting.')
    output.add_argument(
        '--format-url',
        action='store_true',
        help='will print just the url of the revision, for scripting.')

    phlsys_makeconduit.add_argparse_arguments(parser)
Exemple #16
0
def setupParser(parser):
    actions = parser.add_argument_group(
        'action arguments', 'use any of ' +
        textwrap.fill(str(phlcon_differential.USER_ACTIONS.keys())))

    parser.add_argument('ids',
                        type=int,
                        nargs="*",
                        default=[],
                        help="the revisions to comment on (e.g. 1)")
    parser.add_argument(
        '--ids-file',
        metavar='FILE',
        type=argparse.FileType('r'),
        help="a file to read ids from, use '-' to specify stdin")

    parser.add_argument('--message',
                        '-m',
                        metavar="M",
                        default="",
                        type=str,
                        help="the body text of the comment")
    parser.add_argument(
        '--message-file',
        metavar='FILE',
        type=argparse.FileType('r'),
        help="a file to read the message from, use '-' for stdin")
    parser.add_argument('--silent',
                        action='store_true',
                        help="don't send notification emails for this comment")
    parser.add_argument('--attach-inlines',
                        action='store_true',
                        help="attach pending inline comments")
    actions.add_argument('--action',
                         '-a',
                         choices=phlcon_differential.USER_ACTIONS.keys(),
                         metavar="ACTION",
                         default='comment',
                         type=str,
                         help="perform an action on a review")

    phlsys_makeconduit.add_argparse_arguments(parser)
def setupParser(parser):
    parser.add_argument(
        'id',
        type=int,
        help="the revision id to comment on (e.g. 1)")
    parser.add_argument(
        '--message', '-m',
        metavar="M",
        default="",
        type=str,
        help="the body text of the comment")
    parser.add_argument(
        '--message-file',
        metavar='FILE',
        type=argparse.FileType('r'),
        help="a file to read the message from, use '-' for stdin")
    parser.add_argument(
        '--filepath', '-f',
        metavar="FILE",
        default="",
        required=True,
        type=str,
        help="the filename of the file to comment on")
    parser.add_argument(
        '--start-line', '-s',
        metavar="#",
        required=True,
        type=int,
        help="starting line of the comment")
    parser.add_argument(
        '--end-line-offset', '-l',
        metavar="#",
        default=0,
        type=int,
        help="number of extra lines the comment should span, the default is 0"
             "meaning that the comment spans one line only.")
    parser.add_argument(
        '--left-side', '-o',
        action='store_true',
        help="comment on the left (old) side of the diff")

    phlsys_makeconduit.add_argparse_arguments(parser)
Exemple #18
0
def setupParser(parser):
    parser.add_argument('id',
                        type=int,
                        help="the revision id to comment on (e.g. 1)")
    parser.add_argument('--message',
                        '-m',
                        metavar="M",
                        default="",
                        type=str,
                        help="the body text of the comment")
    parser.add_argument(
        '--message-file',
        metavar='FILE',
        type=argparse.FileType('r'),
        help="a file to read the message from, use '-' for stdin")
    parser.add_argument('--filepath',
                        '-f',
                        metavar="FILE",
                        default="",
                        required=True,
                        type=str,
                        help="the filename of the file to comment on")
    parser.add_argument('--start-line',
                        '-s',
                        metavar="#",
                        required=True,
                        type=int,
                        help="starting line of the comment")
    parser.add_argument(
        '--end-line-offset',
        '-l',
        metavar="#",
        default=0,
        type=int,
        help="number of extra lines the comment should span, the default is 0"
        "meaning that the comment spans one line only.")
    parser.add_argument('--left-side',
                        '-o',
                        action='store_true',
                        help="comment on the left (old) side of the diff")

    phlsys_makeconduit.add_argparse_arguments(parser)
def setupParser(parser):
    filters = parser.add_argument_group("filter parameters")
    self_filters = parser.add_argument_group("self filter parameters")
    user_filters = parser.add_argument_group("user filter parameters")
    time_filters = parser.add_argument_group(
        "time filter parameters", textwrap.fill(phlsys_strtotime.describe_duration_string_to_time_delta())
    )
    fmts = parser.add_argument_group("output format parameters", 'choose one only, default is "short"')
    formats = fmts.add_mutually_exclusive_group()

    _setupParserTopLevel(parser)
    _setupParserFilters(filters, self_filters, user_filters, time_filters)

    formats.add_argument(
        "--format-type", choices=["ids", "short", "python", "json"], help="see usage examples for sample output"
    )
    formats.add_argument(
        "--format-string",
        metavar="FORMAT",
        type=str,
        help="compose your own output format, e.g. '$id $title', see " "usage examples for more details",
    )

    phlsys_makeconduit.add_argparse_arguments(parser)
Exemple #20
0
def setupParser(parser):
    phlsys_makeconduit.add_argparse_arguments(parser)
def setupParser(parser):
    diffsrc_group = parser.add_argument_group(
        'Diff arguments', 'Mutually exclusive, one is required')
    diffsrc = diffsrc_group.add_mutually_exclusive_group(required=True)

    opt = parser.add_argument_group(
        'Optional revision arguments',
        'You can supply these later via the web interface if you wish')
    output_group = parser.add_argument_group(
        'Output format arguments',
        'Mutually exclusive, defaults to "--format-summary"')
    output = output_group.add_mutually_exclusive_group()

    diffsrc.add_argument(
        '--diff-id',
        metavar='INT',
        help='the id of the diff to create the file from, this could be '
        'the output from a "arcyon raw-diff" call',
        type=int)
    diffsrc.add_argument(
        '--raw-diff-file',
        '-f',
        help='the file to read the diff from, use \'-\' for stdin',
        metavar='FILE',
        type=argparse.FileType('r'))

    opt.add_argument('--reviewers',
                     '-r',
                     nargs="+",
                     metavar='USER',
                     help='a list of reviewer usernames',
                     type=str)

    opt.add_argument('--ccs',
                     '-c',
                     nargs="+",
                     metavar='USER',
                     help='a list of usernames to cc on the review',
                     type=str)

    parser.add_argument(
        'revision_id',
        help='the id of the revision to update, e.g. the output from a '
        'previous "arcyon create-revision" command',
        type=str)

    parser.add_argument(
        'message',
        help='a short description of the update, this appears on the review '
        'page',
        type=str)

    output.add_argument(
        '--format-summary',
        action='store_true',
        help='will print a human-readable summary of the result.')
    output.add_argument(
        '--format-id',
        action='store_true',
        help='will print just the id of the revision, for scripting.')
    output.add_argument(
        '--format-url',
        action='store_true',
        help='will print just the url of the revision, for scripting.')

    phlsys_makeconduit.add_argparse_arguments(parser)
def setupParser(parser):

    # make a list of priority names in increasing order of importance
    priority_name_list = phlcon_maniphest.PRIORITIES.keys()
    priority_name_list.sort(key=lambda x: phlcon_maniphest.PRIORITIES[x])

    priorities = parser.add_argument_group(
        'optional priority arguments',
        'use any of ' + textwrap.fill(str(priority_name_list)))
    output_group = parser.add_argument_group(
        'Output format arguments',
        'Mutually exclusive, defaults to "--format-summary"')
    output = output_group.add_mutually_exclusive_group()
    opt = parser.add_argument_group(
        'Optional task arguments',
        'You can supply these later via the web interface if you wish')

    priorities.add_argument('--priority',
                            '-p',
                            choices=priority_name_list,
                            metavar="PRIORITY",
                            default=None,
                            type=str,
                            help="the priority or importance of the task")

    parser.add_argument('id',
                        metavar='INT',
                        help='the id of the task',
                        type=str)

    parser.add_argument('--title',
                        '-t',
                        metavar='STRING',
                        help='the short title of the task',
                        default=None,
                        type=str)

    opt.add_argument('--description',
                     '-d',
                     metavar='STRING',
                     help='the long description of the task',
                     default=None,
                     type=str)
    opt.add_argument('--owner',
                     '-o',
                     metavar='USER',
                     help='the username of the owner',
                     type=str)
    opt.add_argument('--ccs',
                     '-c',
                     nargs="*",
                     metavar='USER',
                     help='a list of usernames to cc on the task',
                     type=str)
    opt.add_argument('--projects',
                     nargs="*",
                     metavar='PROJECT',
                     default=[],
                     help='a list of project names to add the task to',
                     type=str)
    opt.add_argument('--comment',
                     '-m',
                     metavar='STRING',
                     help='an optional comment to make on the task',
                     default=None,
                     type=str)

    output.add_argument(
        '--format-summary',
        action='store_true',
        help='will print a human-readable summary of the result.')
    output.add_argument(
        '--format-id',
        action='store_true',
        help='will print just the id of the new task, for scripting.')
    output.add_argument(
        '--format-url',
        action='store_true',
        help='will print just the url of the new task, for scripting.')

    phlsys_makeconduit.add_argparse_arguments(parser)
def setupParser(parser):

    # make a list of priority names in increasing order of importance
    priority_name_list = phlcon_maniphest.PRIORITIES.keys()
    priority_name_list.sort(
        key=lambda x: phlcon_maniphest.PRIORITIES[x])

    priorities = parser.add_argument_group(
        'optional priority arguments',
        'use any of ' + textwrap.fill(
            str(priority_name_list)))
    output_group = parser.add_argument_group(
        'Output format arguments',
        'Mutually exclusive, defaults to "--format-summary"')
    output = output_group.add_mutually_exclusive_group()
    opt = parser.add_argument_group(
        'Optional task arguments',
        'You can supply these later via the web interface if you wish')

    priorities.add_argument(
        '--priority',
        '-p',
        choices=priority_name_list,
        metavar="PRIORITY",
        default=None,
        type=str,
        help="the priority or importance of the task")

    parser.add_argument(
        'title',
        metavar='STRING',
        help='the short title of the task',
        type=str)

    opt.add_argument(
        '--description',
        '-d',
        metavar='STRING',
        help='the long description of the task',
        type=str)
    opt.add_argument(
        '--owner',
        '-o',
        metavar='USER',
        help='the username of the owner',
        type=str)
    opt.add_argument(
        '--ccs',
        '-c',
        nargs="*",
        metavar='USER',
        default=[],
        help='a list of usernames to cc on the task',
        type=str)
    opt.add_argument(
        '--projects',
        nargs="*",
        metavar='PROJECT',
        default=[],
        help='a list of project names to add the task to',
        type=str)

    output.add_argument(
        '--format-summary',
        action='store_true',
        help='will print a human-readable summary of the result.')
    output.add_argument(
        '--format-id',
        action='store_true',
        help='will print just the id of the new task, for scripting.')
    output.add_argument(
        '--format-url',
        action='store_true',
        help='will print just the url of the new task, for scripting.')

    phlsys_makeconduit.add_argparse_arguments(parser)
def setupParser(parser):
    diffsrc_group = parser.add_argument_group(
        'Diff arguments',
        'Mutually exclusive, one is required')
    diffsrc = diffsrc_group.add_mutually_exclusive_group(required=True)
    output_group = parser.add_argument_group(
        'Output format arguments',
        'Mutually exclusive, defaults to "--list-files"')
    output = output_group.add_mutually_exclusive_group()

    diffsrc.add_argument(
        '--revision',
        '-r',
        metavar='INT',
        help='the id of the revision to get the diff from.',
        type=int)
    diffsrc.add_argument(
        '--diff',
        '-d',
        metavar='INT',
        help='the id of the diff to retrieve.',
        type=int)

    output.add_argument(
        '--list-files',
        '--ls',
        action='store_true',
        help='list only the affected paths, shortcut for the --format-type. '
             'this lists the set of files found in the "currentPath" and '
             '"oldPath" fields of the "changes" field.')
    output.add_argument(
        '--format-python',
        action='store_true',
        help='print python representation of the raw response from '
             'the server.')
    output.add_argument(
        '--format-json',
        action='store_true',
        help='print json representation of the raw response from '
             'the server.')
    output.add_argument(
        '--format-unified',
        action='store_true',
        help='outputs a unified diff that can be used to apply the changes'
             'locally to the working copy')
    output.add_argument(
        '--format-files',
        type=str,
        help='write the files to the specified directory (under left, right)')
    output.add_argument(
        '--format-strings',
        '--fs',
        type=str,
        metavar='STR',
        nargs=2,
        help='specify two custom format strings for displaying the items, '
             'the first string is applied to the whole output, the second '
             'is applied per item in the "changes" dictionary. i.e. '
             '("FORMAT-DIFF", "FORMAT-FOREACH-CHANGE").  the strings will be '
             'applied using Python\'s str.format(), so you can use '
             'curly brackets to substitute for field names, e.g. "\{id\}". '
             'you can use "--format-python" to discover the field names.')

    phlsys_makeconduit.add_argparse_arguments(parser)
def setupParser(parser):
    phlsys_makeconduit.add_argparse_arguments(parser)
Exemple #26
0
def setupParser(parser):

    # make a list of priority names in increasing order of importance
    priority_name_list = phlcon_maniphest.PRIORITIES.keys()
    priority_name_list.sort(
        key=lambda x: phlcon_maniphest.PRIORITIES[x])

    priorities = parser.add_argument_group(
        'optional priority arguments',
        'use any of ' + textwrap.fill(
            str(priority_name_list)))
    output_group = parser.add_argument_group(
        'Output format arguments',
        'Mutually exclusive, defaults to "--format-short"')
    output = output_group.add_mutually_exclusive_group()
    opt = parser.add_argument_group(
        'Optional task arguments')

    priorities.add_argument(
        '--priorities',
        '-p',
        nargs="*",
        choices=priority_name_list,
        metavar="PRIORITY",
        default=None,
        type=str,
        help="filter by priority of the task")
    opt.add_argument(
        '--order',
        choices=phlcon_maniphest.ORDERS.keys(),
        default=None,
        type=str,
        help="the ordering of the returned results")
    opt.add_argument(
        '--ids',
        nargs="+",
        metavar='INT',
        default=[],
        help='specific task ids to restrict the query to',
        type=str)
    opt.add_argument(
        '--owners',
        '-o',
        nargs="+",
        metavar='USER',
        default=[],
        help='specific owners usernames to restrict the query to',
        type=str)
    opt.add_argument(
        '--authors',
        nargs="+",
        metavar='USER',
        default=[],
        help='specific author usernames to restrict the query to',
        type=str)
    opt.add_argument(
        '--ccs',
        '-c',
        nargs="+",
        metavar='USER',
        default=[],
        help='specific cc usernames to restrict the query to',
        type=str)
    opt.add_argument(
        '--projects',
        nargs="+",
        metavar='PROJECT',
        default=[],
        help='a list of project names to restrict the query',
        type=str)
    opt.add_argument(
        '--status',
        type=str,
        default=None,
        choices=phlcon_maniphest.STATUS_FILTERS.keys(),
        help='a single status type to restrict items to')
    opt.add_argument(
        '--text',
        type=str,
        metavar='STRING',
        default=None,
        help='string to search the full text of each task for.')
    opt.add_argument(
        '--max-results',
        type=int,
        metavar='INT',
        default=None,
        help='limit the number of results returned, if unspecified then the '
             'server default limit is used (seems to be 1000).')
    opt.add_argument(
        '--offset-results',
        type=int,
        metavar='INT',
        default=None,
        help='where there is a limit on the number of results, you can supply '
             'an offset to return the next batch of results. e.g. if the '
             'number of results is limited to 100, then to see the next "page"'
             'of results, supply an offset of 100.  To see "page 3" of the '
             'results, supply an offset of 200 and so on.  Theres no way to '
             'count the total number of results at present.')

    output.add_argument(
        '--format-short',
        action='store_true',
        help='will print a short human-readable summary of each task.')
    output.add_argument(
        '--format-ids',
        action='store_true',
        help='will print just the ids of the tasks, for scripting.')
    output.add_argument(
        '--format-string',
        type=str,
        default=None,
        help='will print using the supplied format string, e.g. "{id}" '
             'to print a list of ids.  use --format-python to list all the '
             'available attributes for printing.')
    output.add_argument(
        '--format-python',
        action='store_true',
        help='will pretty-print the response as a python object.')
    output.add_argument(
        '--format-json',
        action='store_true',
        help='will pretty-print the response in json.')

    phlsys_makeconduit.add_argparse_arguments(parser)
def setupParser(parser):

    # make a list of priority names in increasing order of importance
    priority_name_list = phlcon_maniphest.PRIORITIES.keys()
    priority_name_list.sort(
        key=lambda x: phlcon_maniphest.PRIORITIES[x])

    priorities = parser.add_argument_group(
        'optional priority arguments',
        'use any of ' + textwrap.fill(
            str(priority_name_list)))
    output_group = parser.add_argument_group(
        'Output format arguments',
        'Mutually exclusive, defaults to "--format-short"')
    output = output_group.add_mutually_exclusive_group()
    opt = parser.add_argument_group(
        'Optional task arguments')

    priorities.add_argument(
        '--priorities',
        '-p',
        nargs="*",
        choices=priority_name_list,
        metavar="PRIORITY",
        default=None,
        type=str,
        help="filter by priority of the task")
    opt.add_argument(
        '--order',
        choices=phlcon_maniphest.ORDERS.keys(),
        default=None,
        type=str,
        help="the ordering of the returned results")
    opt.add_argument(
        '--ids',
        nargs="+",
        metavar='INT',
        default=[],
        help='specific task ids to restrict the query to',
        type=str)
    opt.add_argument(
        '--owners',
        '-o',
        nargs="+",
        metavar='USER',
        default=[],
        help='specific owners usernames to restrict the query to',
        type=str)
    opt.add_argument(
        '--authors',
        nargs="+",
        metavar='USER',
        default=[],
        help='specific author usernames to restrict the query to',
        type=str)
    opt.add_argument(
        '--ccs',
        '-c',
        nargs="+",
        metavar='USER',
        default=[],
        help='specific cc usernames to restrict the query to',
        type=str)
    opt.add_argument(
        '--projects',
        nargs="+",
        metavar='PROJECT',
        default=[],
        help='a list of project names to restrict the query',
        type=str)
    opt.add_argument(
        '--status',
        type=str,
        default=None,
        choices=phlcon_maniphest.STATUS_FILTERS.keys(),
        help='a single status type to restrict items to')
    opt.add_argument(
        '--text',
        type=str,
        metavar='STRING',
        default=None,
        help='string to search the full text of each task for.')
    opt.add_argument(
        '--max-results',
        type=int,
        metavar='INT',
        default=None,
        help='limit the number of results returned, if unspecified then the '
             'server default limit is used (seems to be 1000).')
    opt.add_argument(
        '--offset-results',
        type=int,
        metavar='INT',
        default=None,
        help='where there is a limit on the number of results, you can supply '
             'an offset to return the next batch of results. e.g. if the '
             'number of results is limited to 100, then to see the next "page"'
             'of results, supply an offset of 100.  To see "page 3" of the '
             'results, supply an offset of 200 and so on.  Theres no way to '
             'count the total number of results at present.')

    output.add_argument(
        '--format-short',
        action='store_true',
        help='will print a short human-readable summary of each task.')
    output.add_argument(
        '--format-ids',
        action='store_true',
        help='will print just the ids of the tasks, for scripting.')
    output.add_argument(
        '--format-string',
        type=str,
        default=None,
        help='will print using the supplied format string, e.g. "{id}" '
             'to print a list of ids.  use --format-python to list all the '
             'available attributes for printing.')
    output.add_argument(
        '--format-python',
        action='store_true',
        help='will pretty-print the response as a python object.')
    output.add_argument(
        '--format-json',
        action='store_true',
        help='will pretty-print the response in json.')

    phlsys_makeconduit.add_argparse_arguments(parser)
def setupParser(parser):
    diffsrc_group = parser.add_argument_group(
        'Diff arguments',
        'Mutually exclusive, one is required')
    diffsrc = diffsrc_group.add_mutually_exclusive_group(required=True)
    req = parser.add_argument_group(
        'Required revision arguments',
        'Phabricator requires that you supply both of these')
    opt = parser.add_argument_group(
        'Optional revision arguments',
        'You can supply these later via the web interface if you wish')
    output_group = parser.add_argument_group(
        'Output format arguments',
        'Mutually exclusive, defaults to "--format-summary"')
    output = output_group.add_mutually_exclusive_group()

    diffsrc.add_argument(
        '--diff-id',
        metavar='INT',
        help='the id of the diff to create the file from, this could be '
             'the output from a "arcyon raw-diff" call',
        type=int)
    diffsrc.add_argument(
        '--raw-diff-file',
        '-f',
        help='the file to read the diff from, use \'-\' for stdin',
        metavar='FILE',
        type=argparse.FileType('r'))

    req.add_argument(
        '--title',
        '-t',
        metavar='TEXT',
        required=True,
        help='a short description of the changes to review',
        type=str)
    req.add_argument(
        '--test-plan',
        '-p',
        metavar='TEXT',
        required=True,
        help='how you tested your changes and how the reviewer'
             'can verify them',
        type=str)

    opt.add_argument(
        '--summary',
        '-s',
        metavar='TEXT',
        help='a longer summary of the changes to review',
        type=str)
    opt.add_argument(
        '--reviewers',
        '-r',
        nargs="*",
        metavar='USER',
        help='a list of reviewer usernames',
        type=str)
    opt.add_argument(
        '--ccs',
        '-c',
        nargs="*",
        metavar='USER',
        help='a list of usernames to cc on the review',
        type=str)

    output.add_argument(
        '--format-summary',
        action='store_true',
        help='will print a human-readable summary of the result.')
    output.add_argument(
        '--format-id',
        action='store_true',
        help='will print just the id of the new revision, for scripting.')
    output.add_argument(
        '--format-url',
        action='store_true',
        help='will print just the url of the new revision, for scripting.')

#   parser.add_argument(
#       '--deps', '--depends-on',
#       nargs="*",
#       metavar='ID',
#       type=int)

    phlsys_makeconduit.add_argparse_arguments(parser)
def setupParser(parser):
    diffsrc_group = parser.add_argument_group(
        'Diff arguments', 'Mutually exclusive, one is required')
    diffsrc = diffsrc_group.add_mutually_exclusive_group(required=True)
    output_group = parser.add_argument_group(
        'Output format arguments',
        'Mutually exclusive, defaults to "--list-files"')
    output = output_group.add_mutually_exclusive_group()

    diffsrc.add_argument('--revision',
                         '-r',
                         metavar='INT',
                         help='the id of the revision to get the diff from.',
                         type=int)
    diffsrc.add_argument('--diff',
                         '-d',
                         metavar='INT',
                         help='the id of the diff to retrieve.',
                         type=int)

    output.add_argument(
        '--list-files',
        '--ls',
        action='store_true',
        help='list only the affected paths, shortcut for the --format-type. '
        'this lists the set of files found in the "currentPath" and '
        '"oldPath" fields of the "changes" field.')
    output.add_argument(
        '--format-python',
        action='store_true',
        help='print python representation of the raw response from '
        'the server.')
    output.add_argument(
        '--format-json',
        action='store_true',
        help='print json representation of the raw response from '
        'the server.')
    output.add_argument(
        '--format-unified',
        action='store_true',
        help='outputs a unified diff that can be used to apply the changes'
        'locally to the working copy')
    output.add_argument(
        '--format-files',
        type=str,
        help='write the files to the specified directory (under left, right)')
    output.add_argument(
        '--format-strings',
        '--fs',
        type=str,
        metavar='STR',
        nargs=2,
        help='specify two custom format strings for displaying the items, '
        'the first string is applied to the whole output, the second '
        'is applied per item in the "changes" dictionary. i.e. '
        '("FORMAT-DIFF", "FORMAT-FOREACH-CHANGE").  the strings will be '
        'applied using Python\'s str.format(), so you can use '
        'curly brackets to substitute for field names, e.g. "\{id\}". '
        'you can use "--format-python" to discover the field names.')

    phlsys_makeconduit.add_argparse_arguments(parser)
def setupParser(parser):
    diffsrc_group = parser.add_argument_group(
        'Diff arguments',
        'Mutually exclusive, one is required')
    diffsrc = diffsrc_group.add_mutually_exclusive_group(required=True)
    req = parser.add_argument_group(
        'Required revision arguments',
        'Phabricator requires that you supply both of these')
    opt = parser.add_argument_group(
        'Optional revision arguments',
        'You can supply these later via the web interface if you wish')
    output_group = parser.add_argument_group(
        'Output format arguments',
        'Mutually exclusive, defaults to "--format-summary"')
    output = output_group.add_mutually_exclusive_group()

    diffsrc.add_argument(
        '--diff-id',
        metavar='INT',
        help='the id of the diff to create the file from, this could be '
             'the output from a "arcyon raw-diff" call',
        type=int)
    diffsrc.add_argument(
        '--raw-diff-file',
        '-f',
        help='the file to read the diff from, use \'-\' for stdin',
        metavar='FILE',
        type=argparse.FileType('r'))

    req.add_argument(
        '--title',
        '-t',
        metavar='TEXT',
        required=True,
        help='a short description of the changes to review',
        type=str)
    req.add_argument(
        '--test-plan',
        '-p',
        metavar='TEXT',
        required=True,
        help='how you tested your changes and how the reviewer'
             'can verify them',
        type=str)

    opt.add_argument(
        '--summary',
        '-s',
        metavar='TEXT',
        help='a longer summary of the changes to review',
        type=str)
    opt.add_argument(
        '--reviewers',
        '-r',
        nargs="*",
        metavar='USER',
        help='a list of reviewer usernames',
        type=str)
    opt.add_argument(
        '--ccs',
        '-c',
        nargs="*",
        metavar='USER',
        help='a list of usernames to cc on the review',
        type=str)

    output.add_argument(
        '--format-summary',
        action='store_true',
        help='will print a human-readable summary of the result.')
    output.add_argument(
        '--format-id',
        action='store_true',
        help='will print just the id of the new revision, for scripting.')
    output.add_argument(
        '--format-url',
        action='store_true',
        help='will print just the url of the new revision, for scripting.')

#   parser.add_argument(
#       '--deps', '--depends-on',
#       nargs="*",
#       metavar='ID',
#       type=int)

    phlsys_makeconduit.add_argparse_arguments(parser)