get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/135019/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 135019,
    "url": "http://patches.dpdk.org/api/patches/135019/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20231211095110.18946-12-fengchengwen@huawei.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20231211095110.18946-12-fengchengwen@huawei.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20231211095110.18946-12-fengchengwen@huawei.com",
    "date": "2023-12-11T09:51:09",
    "name": "[RFC,v3,11/12] argparse: pretty help info",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "2e6218ddce389da37be4db08f6d0ba9db23d8026",
    "submitter": {
        "id": 2146,
        "url": "http://patches.dpdk.org/api/people/2146/?format=api",
        "name": "fengchengwen",
        "email": "fengchengwen@huawei.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20231211095110.18946-12-fengchengwen@huawei.com/mbox/",
    "series": [
        {
            "id": 30506,
            "url": "http://patches.dpdk.org/api/series/30506/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=30506",
            "date": "2023-12-11T09:50:58",
            "name": "add argparse library",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/30506/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/135019/comments/",
    "check": "pending",
    "checks": "http://patches.dpdk.org/api/patches/135019/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id B49B2436C8;\n\tMon, 11 Dec 2023 10:55:55 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 9AAF1427E9;\n\tMon, 11 Dec 2023 10:54:41 +0100 (CET)",
            "from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189])\n by mails.dpdk.org (Postfix) with ESMTP id 1EE9040EDF\n for <dev@dpdk.org>; Mon, 11 Dec 2023 10:54:25 +0100 (CET)",
            "from mail.maildlp.com (unknown [172.19.88.105])\n by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4SpcXV2VH3z14M1x;\n Mon, 11 Dec 2023 17:54:18 +0800 (CST)",
            "from dggpeml500024.china.huawei.com (unknown [7.185.36.10])\n by mail.maildlp.com (Postfix) with ESMTPS id A43E414011F;\n Mon, 11 Dec 2023 17:54:23 +0800 (CST)",
            "from localhost.localdomain (10.50.165.33) by\n dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server\n (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id\n 15.1.2507.35; Mon, 11 Dec 2023 17:54:23 +0800"
        ],
        "From": "Chengwen Feng <fengchengwen@huawei.com>",
        "To": "<dev@dpdk.org>, <thomas@monjalon.net>, <ferruh.yigit@amd.com>,\n <stephen@networkplumber.org>",
        "CC": "<tangkunshan@huawei.com>",
        "Subject": "[RFC v3 11/12] argparse: pretty help info",
        "Date": "Mon, 11 Dec 2023 09:51:09 +0000",
        "Message-ID": "<20231211095110.18946-12-fengchengwen@huawei.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20231211095110.18946-1-fengchengwen@huawei.com>",
        "References": "<20231121122651.7078-1-fengchengwen@huawei.com>\n <20231211095110.18946-1-fengchengwen@huawei.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[10.50.165.33]",
        "X-ClientProxiedBy": "dggems703-chm.china.huawei.com (10.3.19.180) To\n dggpeml500024.china.huawei.com (7.185.36.10)",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "This commit aligns help info.\n\nTake dmafwd as an example, previous:\n\noptions:\n -h, --help: show this help message and exit.\n --mac-updating: Enable MAC addresses updating\n --no-mac-updating: Disable MAC addresses updating\n -p, --portmask: hexadecimal bitmask of ports to configure\n -q, --nb-queue: number of RX queues per port (default is 1)\n -c, --copy-type: type of copy: sw|hw\n -s, --ring-size: size of dmadev descriptor ring for hardware copy mode or rte_ring for software copy mode\n -b, --dma-batch-size: number of requests per DMA batch\n -f, --max-frame-size: max frame size\n -m, --force-min-copy-size: force a minimum copy length, even for smaller packets\n -i, --stats-interval: interval, in seconds, between stats prints (default is 1)\n\nNow:\noptions:\n -h, --help                 show this help message and exit.\n --mac-updating             Enable MAC addresses updating\n --no-mac-updating          Disable MAC addresses updating\n -p, --portmask             hexadecimal bitmask of ports to configure\n -q, --nb-queue             number of RX queues per port (default is 1)\n -c, --copy-type            type of copy: sw|hw\n -s, --ring-size            size of dmadev descriptor ring for hardware copy mode or rte_ring for software copy mode\n -b, --dma-batch-size       number of requests per DMA batch\n -f, --max-frame-size       max frame size\n -m, --force-min-copy-size  force a minimum copy length, even for smaller packets\n -i, --stats-interval       interval, in seconds, between stats prints (default is 1)\n\nSigned-off-by: Chengwen Feng <fengchengwen@huawei.com>\n---\n lib/argparse/rte_argparse.c | 67 +++++++++++++++++++++++++++++++------\n 1 file changed, 56 insertions(+), 11 deletions(-)",
    "diff": "diff --git a/lib/argparse/rte_argparse.c b/lib/argparse/rte_argparse.c\nindex bc5b9e87c1..3cfa176e9b 100644\n--- a/lib/argparse/rte_argparse.c\n+++ b/lib/argparse/rte_argparse.c\n@@ -634,8 +634,47 @@ parse_args(struct rte_argparse *obj, int argc, char **argv, bool *show_help)\n \treturn 0;\n }\n \n+static uint32_t\n+calc_help_align(const struct rte_argparse *obj)\n+{\n+\tconst struct rte_argparse_arg *arg;\n+\tuint32_t width = 12; /* Default \"-h, --help  \" len. */\n+\tuint32_t len;\n+\tuint32_t i;\n+\n+\tfor (i = 0; /* NULL */; i++) {\n+\t\targ = &obj->args[i];\n+\t\tif (arg->name_long == NULL)\n+\t\t\tbreak;\n+\t\tlen = strlen(arg->name_long);\n+\t\tif (is_arg_optional(arg) && arg->name_short != NULL) {\n+\t\t\tlen += strlen(\", \");\n+\t\t\tlen += strlen(arg->name_short);\n+\t\t}\n+\t\twidth = RTE_MAX(width, 1 + len + 2); /* start with 1 & end with 2 space. */\n+\t}\n+\n+\treturn width;\n+}\n+\n+static void\n+show_oneline_help(const struct rte_argparse_arg *arg, uint32_t width)\n+{\n+\tuint32_t len = 0;\n+\tuint32_t i;\n+\n+\tif (arg->name_short != NULL)\n+\t\tlen = printf(\" %s,\", arg->name_short);\n+\tlen += printf(\" %s\", arg->name_long);\n+\n+\tfor (i = len; i < width; i++)\n+\t\tprintf(\" \");\n+\n+\tprintf(\"%s\\n\", arg->help);\n+}\n+\n static void\n-show_args_pos_help(const struct rte_argparse *obj)\n+show_args_pos_help(const struct rte_argparse *obj, uint32_t align)\n {\n \tuint32_t position_count = calc_position_count(obj);\n \tconst struct rte_argparse_arg *arg;\n@@ -651,43 +690,49 @@ show_args_pos_help(const struct rte_argparse *obj)\n \t\t\tbreak;\n \t\tif (!is_arg_positional(arg))\n \t\t\tcontinue;\n-\t\tprintf(\" %s: %s\\n\", arg->name_long, arg->help);\n+\t\tshow_oneline_help(arg, align);\n \t}\n }\n \n static void\n-show_args_opt_help(const struct rte_argparse *obj)\n+show_args_opt_help(const struct rte_argparse *obj, uint32_t align)\n {\n+\tstatic const struct rte_argparse_arg help = {\n+\t\t.name_long = \"--help\",\n+\t\t.name_short = \"-h\",\n+\t\t.help = \"show this help message and exit.\",\n+\t};\n \tconst struct rte_argparse_arg *arg;\n \tuint32_t i;\n \n-\tprintf(\"\\noptions:\\n\"\n-\t       \" -h, --help: show this help message and exit.\\n\");\n+\tprintf(\"\\noptions:\\n\");\n+\tshow_oneline_help(&help, align);\n \tfor (i = 0; /* NULL */; i++) {\n \t\targ = &obj->args[i];\n \t\tif (arg->name_long == NULL)\n \t\t\tbreak;\n \t\tif (!is_arg_optional(arg))\n \t\t\tcontinue;\n-\t\tif (arg->name_short != NULL)\n-\t\t\tprintf(\" %s, %s: %s\\n\", arg->name_short, arg->name_long, arg->help);\n-\t\telse\n-\t\t\tprintf(\" %s: %s\\n\", arg->name_long, arg->help);\n+\t\tshow_oneline_help(arg, align);\n \t}\n }\n \n static void\n show_args_help(const struct rte_argparse *obj)\n {\n+\tuint32_t align = calc_help_align(obj);\n+\n \tprintf(\"usage: %s %s\\n\", obj->prog_name, obj->usage);\n \tif (obj->descriptor != NULL)\n \t\tprintf(\"\\ndescriptor: %s\\n\", obj->descriptor);\n \n-\tshow_args_pos_help(obj);\n-\tshow_args_opt_help(obj);\n+\tshow_args_pos_help(obj, align);\n+\tshow_args_opt_help(obj, align);\n \n \tif (obj->epilog != NULL)\n \t\tprintf(\"\\n%s\\n\", obj->epilog);\n+\telse\n+\t\tprintf(\"\\n\");\n }\n \n int\n",
    "prefixes": [
        "RFC",
        "v3",
        "11/12"
    ]
}