From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3E5A94318A; Tue, 17 Oct 2023 14:16:35 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2B88340EE7; Tue, 17 Oct 2023 14:16:35 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 7D0D540273 for ; Tue, 17 Oct 2023 14:16:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697544993; x=1729080993; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=Sb+lezVeImVTKexl0aKkHPXwcy7z2MjYq9FpYCV5ohA=; b=lMqTUNCKU0dv6u5nn/58RupqU8/8hU471buVVvbr6fOGMZaZ4m7tg/Em hbOctWgON9joc8jrvcfIcd5YWk0A64Eo8cAJRA01GlhCXhBgPP41buFPv qtY1bvlw5h+Eld/TK/+JX91wJQ+QKewe73zNCYjAXOAlLwjpKR8tDunkJ L8W5Kgwh2feUJinIgOm2LcFF5/AzYzB/Uxjha/IVQCLd+vxZ4YUx/PgB6 yfldwh4ykL3nLukkEo9wJiMJr7iTPgW/f1UvHOeIf2Zk7U7edQympVbBi kEXyHDpRgG5EDGlHMSv1E/Cr3vfC+45nzyJzB4LIoFsvmyceENHFieeWX A==; X-IronPort-AV: E=McAfee;i="6600,9927,10865"; a="366025965" X-IronPort-AV: E=Sophos;i="6.03,232,1694761200"; d="scan'208";a="366025965" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2023 05:16:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10865"; a="879796199" X-IronPort-AV: E=Sophos;i="6.03,232,1694761200"; d="scan'208";a="879796199" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orsmga004.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 17 Oct 2023 05:16:32 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Tue, 17 Oct 2023 05:16:31 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32 via Frontend Transport; Tue, 17 Oct 2023 05:16:31 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.40) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.32; Tue, 17 Oct 2023 05:16:31 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jDimORHZiQROxAEDggK4ZrJc2LDfMU8z+hTL4P9ZhC9/M2ST4+PSWKPilMUud52I0MMSy2NA1sQjKmxuKuIkbAObHxpFSTHUVq6oVPAcK2i/p8F6UwCxQN/Wbg3mqM+cKnc+bNdSCW4NbNeSn10OWVxeLHO3dhOJj8jnT5aW4n/9DVt7mKQWdrNUr4oj6hrcp63ncc4QUchl5WYiEglj/sXzEMz0TYLfrphErsxHPfEIP7+vYdEeV3EjH+hCsJJXmB/7GLU4MMZyuFjelDNMI72alFO9C9v4sHP7vMClWMN7n0eBwjX/kLofvHuC74/to2wfWPGNSepNWOoQW1Dh6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=m/h2oh1xky2ElF0Wvx1GyltLhJUBhznEZY/PvdrSJo0=; b=AolLk3jqCK1uIE9MWsxh252lGyWrw6y7YDuYQ1LKSbrUF9WJRLfFvnIfoHVsV1LVacAHZCO+vNHsthjZ0xoyu1BXAfYceqCOK5mf6xz512mh+LQ6FLRr0tZjklkOasJxhwqz6Jt78uurMrVk4stUS2rQYW7BvlL0QL87rANnnDWAXwKDt2y0T9D0UDGWGzyLcB8znuueAMXP9UaWmra4d5xf1v8QmxMUM+NxKvwVl6Ja7s+tPPJYimFxVNmpYRorVZFS373wasdSrvxousEciZjerGwRXLM8h2LvqE+GdHov/LijRFP9GaOzz2vnTAGEfxBVyJUcn7n16tymyT1jHQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) by DM4PR11MB7280.namprd11.prod.outlook.com (2603:10b6:8:108::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36; Tue, 17 Oct 2023 12:16:30 +0000 Received: from DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::68fb:c3f4:75e7:5fb5]) by DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::68fb:c3f4:75e7:5fb5%4]) with mapi id 15.20.6886.034; Tue, 17 Oct 2023 12:16:30 +0000 Date: Tue, 17 Oct 2023 13:16:26 +0100 From: Bruce Richardson To: David Marchand CC: , Subject: Re: [PATCH v4 0/7] document and simplify use of cmdline Message-ID: References: <20230802170052.955323-1-bruce.richardson@intel.com> <20231016140612.664853-1-bruce.richardson@intel.com> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: DUZPR01CA0112.eurprd01.prod.exchangelabs.com (2603:10a6:10:4bb::11) To DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7309:EE_|DM4PR11MB7280:EE_ X-MS-Office365-Filtering-Correlation-Id: 9b9df62d-2f00-48c1-4900-08dbcf0ae4f6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VN1qyivuxXN5oTk/N+opGXSUK1byaZIBENWuVUoHh80yhfMNaZAIgS99kIeNC96TWYHA2bqvPttyrHhfT1enlalFiWzaYmFxP1zkCicDQuF7viPkUYfUMTPsQYIb3gYFrcZlGw9MuR0W9c4pM3bUxzxH5jpOegvailhgUblgkw4KxMWlzdhftr0Qu4IzIw0kntz+n6GV3l+o0VlZ4w4elBdFTnKoa0m63idQeT6OiX4WcRR3aFlpx2gvCpGaB+pwTzCnPLCYHbWujd7rQLdi5FM4siKKgNcm40pemjeCXD82j/w65HmKvRvw0mNpHvCXoAjrManzbHVTUehkNjk84FSXBi3CffH07TUkov4XedYaNJ90XHLsXVTAbeZRyyhl2jQ8kWnyppjtmblXHKs/LiNWoLh+xDn4RuOnwFHU1Cst2F/JX44JerbwoP9k1T5Yt8lGY68M2chXHne3qi7YGM4jeoMwpU5ajOarJr7wgnbtJzLHNvGu8sW3yuKErXtSsE84zMolb8S13jtJWcN4ITUjIe4foPS7L9QgjyobisT59EZVZmH7tJg1cMYN4yOE X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS0PR11MB7309.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(39860400002)(366004)(376002)(136003)(346002)(230922051799003)(1800799009)(451199024)(186009)(64100799003)(86362001)(41300700001)(44832011)(6506007)(5660300002)(8936002)(38100700002)(4326008)(8676002)(2906002)(66946007)(66556008)(66476007)(316002)(6916009)(6512007)(82960400001)(26005)(6486002)(6666004)(478600001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?sIYtPwpMPf8iaqE3BmJl3DusvxUsvdYz9SRXL0exlHkpnJwZ5fxfoHII1VMY?= =?us-ascii?Q?1ABSHHvErl/ff6Fq5xQPa2nzKY8Gatsvsg/MOPJTSlV7y85sCvBOUgVsahS/?= =?us-ascii?Q?fv8cfDjyiOgEGUnmkc4eMYo7fCnyDeLTLB1DKA28ld4E+tuQji7BjksGr1Tj?= =?us-ascii?Q?MKGqoMU1oONsf/hBblb8TrreqowE/kP1BMoL/vCKBPadT24Su4vRPSxxceJX?= =?us-ascii?Q?+gI6nqg2mubTZ2lFTfj0Ap9wGia2iArDhIt6TLkYyJtEGaVNywxjYYuqn4Uz?= =?us-ascii?Q?Mx8uE7NrVp9yCfMFhpXrD422FmeQqg9h6bSyBylBizWIinfzYv7BLMaMREuu?= =?us-ascii?Q?CllpuOdc9NJe1xO9nUWw36gO944PxK0Mf1ugI5xqgb+SbsYXG9XXxpnIRbCf?= =?us-ascii?Q?yEJ/GCc/4AK5ZwVcB5H9zWxa0ijkf4tX0xe53fBn5CN13zJcMq50E6Ao/grK?= =?us-ascii?Q?fxETDxHrrAb60rO+fnbAOaII/FPlZjytJehNrluetjromZxa0E2qCHcxNHRx?= =?us-ascii?Q?q2P3926+MwR0VVnVZm8M5SA0Vi51MrUTZT6hzAI9QlfLI5zS/eNUOLDmbN80?= =?us-ascii?Q?yIBMbkJryLmRKBtCftEyQ2oopCLaAH3JYbpKSYXTS8mS8Sqz2PwWi9WOdgTj?= =?us-ascii?Q?EGljRe6R/joB9InjnvZrwoFuV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boDcuvw?= =?us-ascii?Q?pJ9Q09E6/FjX9RSqEQF+s2/Dwli+H5NJhHod6uLXmd5g33FRag5PhO8dGy/I?= =?us-ascii?Q?hQ=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 9b9df62d-2f00-48c1-4900-08dbcf0ae4f6 X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7309.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2023 12:16:30.3306 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: K+6MSXmVhyqMDKwU1tEUWRdKgY1yhjvJqS2wy/msgjjAI+XOZM/6EzivA/TJKcLpFnbrJaFB5qdnKZJiFhSF7Z9p7LwayYAOHhBAkPAkybw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR11MB7280 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Tue, Oct 17, 2023 at 09:29:34AM +0100, Bruce Richardson wrote: > On Tue, Oct 17, 2023 at 09:10:51AM +0200, David Marchand wrote: > > > > - Multi choice fixed strings is something that is often used in > > testpmd, like here, in the help
command. Here is my quick > > hack: > > > > diff --git a/buildtools/dpdk-cmdline-gen.py > > b/buildtools/dpdk-cmdline-gen.py index 3b41fb0493..e8c9e079de 100755 > > --- a/buildtools/dpdk-cmdline-gen.py +++ > > b/buildtools/dpdk-cmdline-gen.py @@ -35,7 +35,11 @@ def > > process_command(tokens, cfile, comment): for t in tokens: if > > t.startswith('<'): t_type, t_name = t[1:].split('>') - t_val > > = 'NULL' + if len(t_type.split('(')) == 2: + > > t_type, t_val = t_type.split('(') + t_val = '"' + > > t_val.split(')')[0] + '"' + else: + t_val = > > 'NULL' else: t_type = 'STRING' t_name = t @@ -113,7 +117,7 @@ def > > process_commands(infile, hfile, cfile, ctxname): continue if '#' not in > > line: line = line + '#' # ensure split always works, even if no help > > text - tokens, comment = line.split('#', 1) + tokens, > > comment = line.rsplit('#', 1) > > instances.append(process_command(tokens.strip().split(), cfile, > > comment.strip())) > > > > print(f'static __rte_used cmdline_parse_ctx_t {ctxname}[] = {{') > > > > > > Which translates as: cmd_brief:help # help: Show help help > > section # help: Show help > > > > +1 I was actualy thinking that adding support for multi-choice fixed > strings is something we should add. One thought that I had was that "#" > is not a particularly good choice of separator here. While, as you show, > it can be made to work; I think - since we are defining our own syntax > here - that it would be both simpler for the script, and simpler for the > user, to have "|" as the option separator. It should be familiar for > everyone as an option separator from regexes, unlike "#" which is more > familar for comments. > > So what about: help <|all|control|display|config|ports|>section > > By starting with the separator, we should avoid having to provide the > STRING type at all. > This (my suggestion) is now prototyped in V5. I've kept it as a separate patch so it's easily to review and discuss without affecting the rest of the set. To test it out, I've converted over the ntb example app which uses option lists. /Bruce