Message ID | 20230802170052.955323-1-bruce.richardson@intel.com (mailing list archive) |
---|---|
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]) by inbox.dpdk.org (Postfix) with ESMTP id 33A5A42FB8; Wed, 2 Aug 2023 19:01:03 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B898E410DC; Wed, 2 Aug 2023 19:01:02 +0200 (CEST) Received: from mgamail.intel.com (unknown [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id C532840DDB for <dev@dpdk.org>; Wed, 2 Aug 2023 19:01:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1690995662; x=1722531662; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=eiHaEMikly5HaCqHlYbHvj71NBKuoo+IUg6FApHAbqU=; b=mnb0bqYGAIfgo3bkihe1YybRto+N/+Ce2g2vOyCheiR7hh2A5ym90Pql UsvJqKAd3Ovc1rm76oRvI75OXfrqwiXf3fsIDuQXP4/Mzwis8+urYh7f1 80J1J1W95k8/jxhyKFsGwTrdXPdJbCWLWuNoIp5XFO008Fd0NerNY93NI dKybzoX711nyBYfsv4eUn6dHof5g2twT2IpzYx4VQK6E+oHIaxnviLGAG H9T/qFW3C8X8WCSSV5MZ8MtLhuNk2FLDixHPmvwLzLFio5AaOUH4KqSEq RS4AXs18sHPVErKRn3FSfE1pzkKHsmuzRyOnakMnGdgoCe1LiD4fvZO4N w==; X-IronPort-AV: E=McAfee;i="6600,9927,10790"; a="368545934" X-IronPort-AV: E=Sophos;i="6.01,249,1684825200"; d="scan'208";a="368545934" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Aug 2023 10:01:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10790"; a="852943949" X-IronPort-AV: E=Sophos;i="6.01,249,1684825200"; d="scan'208";a="852943949" Received: from silpixa00401385.ir.intel.com ([10.237.214.162]) by orsmga004.jf.intel.com with ESMTP; 02 Aug 2023 10:00:59 -0700 From: Bruce Richardson <bruce.richardson@intel.com> To: dev@dpdk.org, Olivier Matz <olivier.matz@6wind.com> Cc: Bruce Richardson <bruce.richardson@intel.com> Subject: [RFC PATCH 0/1] make cmdline library easier to use Date: Wed, 2 Aug 2023 18:00:51 +0100 Message-Id: <20230802170052.955323-1-bruce.richardson@intel.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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>, <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>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org |
Series |
make cmdline library easier to use
|
|
Message
Bruce Richardson
Aug. 2, 2023, 5 p.m. UTC
And now for something completely different... :-) While it's nice that DPDK includes a commandline library for easily adding interactivity to applications, the library itself is a little clunky to use, due to the massive amounts of boilerplate definitions required. Having used it recently on an app I was playing with for testing, I decided the situation can potentially be improved with it by use of a script to produce the boilerplate when given a simple list of commands the user wants to add to the app. This is the result of that effort. Sending it here as a rough-draft to get feedback on whether this is worth including in DPDK itself. Hopefully others may find it of use. Bruce Richardson (1): cmdline/dpdk-cmdline-gen: generate boilerplate for simple cmds lib/cmdline/dpdk-cmdline-gen.py | 143 ++++++++++++++++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100755 lib/cmdline/dpdk-cmdline-gen.py -- 2.39.2
Comments
On Wed, 2 Aug 2023 18:00:51 +0100 Bruce Richardson <bruce.richardson@intel.com> wrote: > And now for something completely different... :-) > > While it's nice that DPDK includes a commandline library for easily > adding interactivity to applications, the library itself is a little > clunky to use, due to the massive amounts of boilerplate definitions > required. Having used it recently on an app I was playing with for > testing, I decided the situation can potentially be improved with it > by use of a script to produce the boilerplate when given a simple > list of commands the user wants to add to the app. > > This is the result of that effort. Sending it here as a rough-draft to > get feedback on whether this is worth including in DPDK itself. > Hopefully others may find it of use. > > Bruce Richardson (1): > cmdline/dpdk-cmdline-gen: generate boilerplate for simple cmds > > lib/cmdline/dpdk-cmdline-gen.py | 143 ++++++++++++++++++++++++++++++++ > 1 file changed, 143 insertions(+) > create mode 100755 lib/cmdline/dpdk-cmdline-gen.py Ok, but this surely is a solved problem is some other open source library. Or does every project reinvent this parsing? Seems to me that something like bison/flex (ie yacc/lex) would be better in terms of expressing the syntax separate from the implementation.
On Wed, Aug 02, 2023 at 11:05:07AM -0700, Stephen Hemminger wrote: > On Wed, 2 Aug 2023 18:00:51 +0100 > Bruce Richardson <bruce.richardson@intel.com> wrote: > > > And now for something completely different... :-) > > > > While it's nice that DPDK includes a commandline library for easily > > adding interactivity to applications, the library itself is a little > > clunky to use, due to the massive amounts of boilerplate definitions > > required. Having used it recently on an app I was playing with for > > testing, I decided the situation can potentially be improved with it > > by use of a script to produce the boilerplate when given a simple > > list of commands the user wants to add to the app. > > > > This is the result of that effort. Sending it here as a rough-draft to > > get feedback on whether this is worth including in DPDK itself. > > Hopefully others may find it of use. > > > > Bruce Richardson (1): > > cmdline/dpdk-cmdline-gen: generate boilerplate for simple cmds > > > > lib/cmdline/dpdk-cmdline-gen.py | 143 ++++++++++++++++++++++++++++++++ > > 1 file changed, 143 insertions(+) > > create mode 100755 lib/cmdline/dpdk-cmdline-gen.py > > Ok, but this surely is a solved problem is some other open source library. > Or does every project reinvent this parsing? > > Seems to me that something like bison/flex (ie yacc/lex) would be better > in terms of expressing the syntax separate from the implementation. Sure, but it has been many, many years since I last even looked at those tools, so it was faster for me to just use this python script for quick cmdline generation when prototyping things! :-) I wanted something that worked for me, so I'm just sharing it with the community in case others find it useful. If you have time, please do indeed come up with a lex/yacc generator instead, it would indeed be a better solution. [If not, I suggest we take what we can get if it works! :-)] /Bruce