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 9EB3443199; Wed, 18 Oct 2023 13:37:15 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4B484402CD; Wed, 18 Oct 2023 13:37:15 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 3250340261 for ; Wed, 18 Oct 2023 13:37:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697629033; x=1729165033; h=date:from:to:cc:subject:message-id:references: content-transfer-encoding:in-reply-to:mime-version; bh=HOWOIECfQesZwUNHFjSrw3HtT7nFhA5MQ8ut3aaxcGU=; b=fJBpMJLnptz/er9sNzV/EzR/FdzMBug8CVngM15OI8WVuGhaQTDLVoKW nxdAHlr2MouHZAml0xDV3Q6L2npo3PL/K1kedXGJ/r06ohvZONVsKii5z EMnHcNiP5qGR22wWXrd5lMBfAotbiw2jJOwL9LoL6j//0AJbODycO0+/K qPSLom4Rhxdyq9IMPalf3pbVgU8u+ZDPIoVPTNFLAUqnYFZTxHU1JAJ5F vLcQMYEX/pn/qDzSvath6UhuqfjG9pzhIQDZw3PwzCe9IQ7iOnSYEmxSC qwR61OaYjTMDKmd1JVh8EKEagpqxdWkCimh9iniF4JlA9OxE60KbEs4YB g==; X-IronPort-AV: E=McAfee;i="6600,9927,10866"; a="450216536" X-IronPort-AV: E=Sophos;i="6.03,234,1694761200"; d="scan'208";a="450216536" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Oct 2023 04:37:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10866"; a="706418193" X-IronPort-AV: E=Sophos;i="6.03,234,1694761200"; d="scan'208";a="706418193" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by orsmga003.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 18 Oct 2023 04:37:11 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Wed, 18 Oct 2023 04:37:11 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32 via Frontend Transport; Wed, 18 Oct 2023 04:37:11 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.100) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.32; Wed, 18 Oct 2023 04:37:11 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MyZOoj1Kh8pc6dlpxKBmUmVY0QEm0HaNAtnlPilfZ9cNx0DM5t0QsfiI80jo8L0IB1lWOgvl69TjYqmDnPl3l9pF1nNoBgwqQaDv/ar0JXZGi3Egg2SSAasGQrQ+I1CBV/FXFyNu/8WdhFaeetK9IYg4IGAw5BP8teEKTbA/RBVj1Rp5XwCwnjXd7E3ENOocF59VcyqR590zAxOPQhyQim7n65eaysGmuU8LwIp4dQGXpnLRFOfbEJuxbI5xBkQtZZCP9Z5dxC9sJ+WOR0/Hnn2s9rnnxVjDOEed+cmeOvqvGteq0AOtvYrqVfxEt695Bx9prc+oorbiFdiMFVF1cA== 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=ozK0jgA3FWxED3hY1L/klnmNr+XPZRLLCHI2JWKNaPg=; b=iuD3POXhrbslaJ6qx2Jth74fCWKJMcLBcFDDTUDro4Qg7TIcZDg4ONR1B1dmb+QWGYE+vRLcHva9RTFWgNV+AvukMzdO+3hjGHZ9LRei0evCLQGUGFzeV9/ZhcSgSJqENdHyV3anyS05I8cc8IFb8AWgfw4uTJaz1G+DZge/kcHJRKKTFT2T5z9ClE5fWwM1KYQRGISGPTX8Gvf19qMipO7507B4Ac7kKtXEy73CHsIrtTSv8Z+o6wibNRNhF12s06VOUNh8mOTgz3Sud1/48Lr7BzgjwfwpQNup5K0TTKcuTqZLqE3kjUR3XLRsQWcrfvG6TMZwvwzb6sucRrYuTQ== 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 PH7PR11MB8009.namprd11.prod.outlook.com (2603:10b6:510:248::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.24; Wed, 18 Oct 2023 11:37:07 +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; Wed, 18 Oct 2023 11:37:07 +0000 Date: Wed, 18 Oct 2023 12:37:01 +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="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-ClientProxiedBy: DB8PR03CA0009.eurprd03.prod.outlook.com (2603:10a6:10:be::22) To DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7309:EE_|PH7PR11MB8009:EE_ X-MS-Office365-Filtering-Correlation-Id: d676581a-186c-4068-8010-08dbcfce8f01 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CAYmEZU/wuh4cjuIZmIRZvyUrzCaEnwVHBXHbJxMMpruh63mMsKXP7Sm7XxSANLknD9AcudCfV04LJqkXgXoic5H7zAIYVbPVARDDwfjxGJPqLTzlKgu+9soCmPV9x4SRsKDDB4m4qXenSBFxl8GTB69AloIRQzniMf8wcgFxZRdPmUKZuDbLtOe5WaFDn6r9zgVH8SaobRMrjefRkFnxbaFadg/GR+Uvjbx7AmWCD+b0Cg6WxwbMQpqID5dI+MVI9CkyOrxnqEDaOc7E8ZmHzv6gi/bVHHq5wqIXi/WYWgZTLpMMsTt9XJsppswzRq+jWf862LJ4QX4Hwm1y2nuYayyJLq+6R+Pp/+EPKPX19SLRbgg9XhrqAeQ2HUiLUakNHOkC2uNcQAHJKRK50bs/THtktjD87AnpXmgehCzuI7u/9CN5IahX5DZ/A8rfNQJ8AsEvr8eFfup9tvUe7tnNi7xJpld0nkuqJqG2RSHiPyGE3A0KP18ZOC7l2t+dfEbmctdx0TtJifCSuGq8uKj7mdtIxgkw5nmFaUGPTlLfzV1bAuzRAKk932olkMr51OI 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)(39860400002)(346002)(396003)(136003)(376002)(366004)(230922051799003)(186009)(1800799009)(451199024)(64100799003)(6506007)(53546011)(5660300002)(41300700001)(2906002)(44832011)(38100700002)(86362001)(6666004)(6486002)(8676002)(8936002)(66476007)(4326008)(6916009)(66946007)(316002)(83380400001)(26005)(82960400001)(66556008)(6512007)(478600001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?WEI5b1BlUkJoWTlDYWN3b0UwbnBZbll1VWdxRDVHelpBZndLL2ZiU09mYUJB?= =?utf-8?B?bmlqVndtTEdkMVBkR2lpM21waG1VUno5RXZzSWl0dHpkWDRVWG91SVRZTXVU?= =?utf-8?B?QVFnWWdOMEdrenFKUWIrVE5ISzdYa0I1VUpjSE9JS2krc0VBbVlnR1BCM29F?= =?utf-8?B?NmZNRUxLczRKS2NRdWUvN3phTFlKU3pOaThYTDJrSDIyUDZqU0M2QnhDMUd6?= =?utf-8?B?MlZYZklTOGZDc1M2YU03VWkyQU5tWW4xMmVXR251aldJV3V3U3RLbVVPbjQ2?= =?utf-8?B?MHpPZjAwaVZ2ZFVaS212Y3FDcExHdEFuRVlWeE1EOVMvR3BTYXFDWVFCbXBT?= =?utf-8?B?SmdvemxadzdEWnZhUmpGWjJQQ2pSaitTZmc1aGlkTG0xazI1d2lGeVBTcnNV?= =?utf-8?B?T254cWNRbXVXejF1UjJKVHlab1VGRzRkOXBpTkZZMjJhRXZWTUoxd09DYTlE?= =?utf-8?B?TnB2citBQ3A0VDNCcEhBR29QZEs3TzZEK1A5dWIxYUdwY3VJNnNUS2tERmdJ?= =?utf-8?B?TUNZNDJkMVI0dnlxYXpTRzV2L0YyTVlSNGlweElmV1FXbnRNb0V3SzZaMzB1?= =?utf-8?B?V29JRmRXMW5TWWMyQnVqR3diVTJRVkJOa1RFUVhHOU5SQWZJZzJTRHUvcWZS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a3NC?= =?utf-8?B?eTdzeE9iUWkxcjBCTmptRlNqbkQ0WGlXK21NbE9wMXlQVkpBbm90dkZaMFE1?= =?utf-8?B?WGsxT1Z1eHE2VXdzMnZsenRJcEg1ZkVHeHR2T0FrVXc4UEVPSlZIbTZPM2gz?= =?utf-8?B?WXVWbkVWbUxVR0dRL1FNSXN5Ull3RnBqTkpBb1lUaXJHdWQ1cGgrUUhiM3Yx?= =?utf-8?B?T051YldMZEhlS2tMeC9aM2Q2QmUzK0RndG5RaURuSmh3NGtXRUtyZHhObEl2?= =?utf-8?B?TmpaVjJHWXU3N2l3VFB3V2F1Ly9tZWYrK2dGd29xbmhRUHhXbWZza1dYa2VS?= =?utf-8?B?cHRyVkg2SllBR1dYTnZMMDJWZWZsYXVKY2RqUnBBVk4vYmNHNVpEWTdaWGt5?= =?utf-8?B?THpSU3JQYWhabTBHb3ZaQWdiTmVJUi84T21WbTVaT1UxYUxBMzJJUTkzdDB6?= =?utf-8?B?YkRFcHRGd0xDdnN4SStnSzB6REROaXNrZXRqTERwV0I3ZCtVNFowS3BodzZU?= =?utf-8?B?bG1ZbldrUjlpamU2dzN1NWRkM2NqMFdXYkpDVERVS3RPZnRKcktqbGdMaG5R?= =?utf-8?B?ZC9IK3A4eG1zaGVpcjZnTHR0eDFRYXR6bnRvWGxxd01xaEs3eWhiOVRiRTJ4?= =?utf-8?B?RWc9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: d676581a-186c-4068-8010-08dbcfce8f01 X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7309.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2023 11:37:07.4092 (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: CpzoU3HtfXecg6ZoztkTtT4nh+X9s66UbrYwdbLmMFPbTeTR8J5bXU5Kplus6vaAOQAIBNr9Qb0Ra+CaUlinnot3+TuxatZ1zAF1oda92Es= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB8009 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 Wed, Oct 18, 2023 at 01:21:40PM +0200, David Marchand wrote: > Hello Bruce, > > > On Tue, Oct 17, 2023 at 7:08 PM Bruce Richardson > wrote: > > > > sure I like it that much as a feature :-) I rather like having unique > > > > prefixes for each command. I wasn't actually aware of the testpmd "help > > > >
" command at all. I will have to look into it. > > > > > > Let me propose an alternative hack. > > > I mentionned previously that we could have a better namespace / > > > discriminant for those symbols, and it seems easier than I thought: > > > > > > @@ -25,8 +25,10 @@ def process_command(tokens, cfile, comment): > > > sys.exit(1) > > > for t in tokens: > > > if t.startswith('<'): > > > - break > > > - name.append(t) > > > + t_type, t_name = t[1:].split('>') > > > + name.append(t_name) > > > + else: > > > + name.append(t) > > > name = '_'.join(name) > > > > > > result_struct = [] > > > > > > With this, any command implementation symbol has the full chain of > > > token names as a prefix which will ensure there is no conflict. > > > WDYT? > > > > > Having thought a little more about it, I still don't like having the full > > command in all cases, but I can see it being useful for cases of > > overlapping prefixes. > > > > How about making it optional - setting a flag in the typename, or in the > > parameter name to indicate that it should be included in the overall > > command name. For example, if we prefix the variable name with "_" or "__", > > it could indicate that we can choose to include this. > > > > show port n --> void cmd_show_port_parsed(...) > > show port _n --> void cmd_show_port_n_parsed(...) > > > > I think I get what you mean, and it seems acceptable. > Cool. Any suggestions for a preferred prefix to indicate inclusion in the cmd name? "_", "__" or something else? I'm trending towards single "_" as above. > > > Prefixes on strings beyond initial tokens could just be silently stripped. > > By initial tokens, do you mean fixed strings token before a <> typed token ? > Yes. So: add x --> cmd_add_parsed add _x --> cmd_add_x_parsed add _x _y --> cmd_add_x_y_parsed add x _y --> cmd_add_parsed, strip "_" off y silently /Bruce