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 194EE42351; Thu, 12 Oct 2023 15:21:37 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E61DF402E2; Thu, 12 Oct 2023 15:21:36 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 91611402C9 for ; Thu, 12 Oct 2023 15:21:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697116895; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IZFbsEcFrW3+hvHCOX6pQ5UcyShLHwiOZQyQmBvsab0=; b=RT/Z7KYRgyAreXMPYx5GuQwtxBTVMj33hvtH2EuQBPw0nuSwD4wsInza/0ZhrgB0rOJVEo CWrMiCqgIG8e+28Q+JYqRo5uY2Gu6uUuPw7qStnzFzu8MB0fk3nzzABySQHjLr8VCt25Zz QL24GQm2Srv/fEiHnkysZo5RhpMqGIw= Received: from mail-lj1-f198.google.com (mail-lj1-f198.google.com [209.85.208.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-266-mva_YE1hO7mgJiIeWX55dA-1; Thu, 12 Oct 2023 09:21:22 -0400 X-MC-Unique: mva_YE1hO7mgJiIeWX55dA-1 Received: by mail-lj1-f198.google.com with SMTP id 38308e7fff4ca-2bfe60dfbc3so8519441fa.3 for ; Thu, 12 Oct 2023 06:21:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697116881; x=1697721681; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IZFbsEcFrW3+hvHCOX6pQ5UcyShLHwiOZQyQmBvsab0=; b=EA6pZH2LfjL0m8kLkSvr5AlsaIIHDMBFPK0kcedZhl01JLDPCDWWXIztkaBK9z5QW/ wgXWJV9XacJ7ynZNn9yAiIDDawEJD8uBiqLYy2oGzAgrRmBQzEheeYKVu9uw/6CuqBpL 6swC9vMa+vNzaI3vkdWs185BsKFJwgdDAV/GupPkNfTzARAtbd29oCzI4gQbMkSNfmXt Wl7MnbeMwGZTyhQ3Nzek2FP0VFUjH1kndNAYK9kCwo73gRxJBwF6RzZSuetcm1y6TTMg tZ7v1h73l0EVU03OsSh7qwmtkrR7AwVRV6wXEItTqCCCmFF1uCiBCKLMjqFhJ7z0flux KjwA== X-Gm-Message-State: AOJu0YwIN2g9qljdpvcbXAjGaYMY8yHzsvL/NsDCwoOQX86fKjuDYDDU Puvv1pO2oxVyc5mI5jDQC758+dm2AZhXedFQLM35vrQOfS0i3Mgw/wYADdgmCNfRpJsXrQtGYtq E0rLgVisZELxNFqreYbw= X-Received: by 2002:a2e:b0f2:0:b0:2b9:4b2e:5420 with SMTP id h18-20020a2eb0f2000000b002b94b2e5420mr20457704ljl.52.1697116880916; Thu, 12 Oct 2023 06:21:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGXSjHCoBoWKgSXmbIKNH59OTkLDZGfYglslrZJsvJqFIGL1uWiP15oA3BvWDY2b+8KpFRNjbXfHhbOMXrFDdA= X-Received: by 2002:a2e:b0f2:0:b0:2b9:4b2e:5420 with SMTP id h18-20020a2eb0f2000000b002b94b2e5420mr20457686ljl.52.1697116880552; Thu, 12 Oct 2023 06:21:20 -0700 (PDT) MIME-Version: 1.0 References: <20230802170052.955323-1-bruce.richardson@intel.com> <20231011133357.111058-1-bruce.richardson@intel.com> In-Reply-To: <20231011133357.111058-1-bruce.richardson@intel.com> From: David Marchand Date: Thu, 12 Oct 2023 15:21:08 +0200 Message-ID: Subject: Re: [PATCH v3 0/5] document and simplify use of cmdline To: Bruce Richardson Cc: dev@dpdk.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 11, 2023 at 3:34=E2=80=AFPM Bruce Richardson wrote: > > The DPDK commandline library is widely used by apps and examples within > DPDK, but it is not documented in our programmers guide and it requires > a lot of boilerplate code definitions in order to used. We can improve > this situation by creating a simple python script to automatically > generate the boilerplate from a list of commands. > > This patchset contains a new documentation chapter on cmdline library, > going through step-by-step how to add commands and create the necessary > token lists and parse contexts. > > Following that initial doc patch, the set then contains a > boilerplate-generating script, as well as a set of three patches showing > its use, by converting three examples to use the script instead of > having the hard-coded boilerplate. Once the script is used, adding a new > command becomes as simple as adding the desired command to the .list > file, and then writing the required function which will be called for > that command. No other boilerplate coding is necessary. > > Script obviously does not cover the full range of capabilities of the > commandline lib, but does cover the most used parts. The code-saving to > each of the examples by auto-generating the boilerplate is significant, > and probably more examples with commandlines can be converted over in > future. > > The "cmdline" example itself, is not converted over, as it should > probably remain as a simple example of direct library use without the > script. > > V3: > * Added lots of documentation > * Added support for help text for each command > * Cleaned up script a little so it passes pycodestyle and most flake8 > checks, when line-length is set to max 100. > * Removed RFC tag, as I consider this patchset stable enough for > consideration in a release. > > V2-RFC: > * Add support for IP addresses in commands > * Move to buildtools directory and make installable > * Convert 3 examples to use script, and eliminate their boilerplate > > Bruce Richardson (5): > doc/prog_guide: new chapter on cmdline library > buildtools: script to generate cmdline boilerplate > examples/simple_mp: auto-generate cmdline boilerplate > examples/hotplug_mp: auto-generate cmdline boilerplate > examples/bond: auto-generate cmdline boilerplate > > app/test/commands.c | 2 + > buildtools/dpdk-cmdline-gen.py | 167 +++++++ > buildtools/meson.build | 7 + > doc/guides/prog_guide/cmdline.rst | 466 ++++++++++++++++++ > doc/guides/prog_guide/index.rst | 1 + > examples/bond/Makefile | 12 +- > examples/bond/commands.list | 6 + > examples/bond/main.c | 161 +----- > examples/bond/main.h | 10 - > examples/bond/meson.build | 8 + > examples/multi_process/hotplug_mp/Makefile | 12 +- > examples/multi_process/hotplug_mp/commands.c | 147 +----- > examples/multi_process/hotplug_mp/commands.h | 10 - > .../multi_process/hotplug_mp/commands.list | 5 + > examples/multi_process/hotplug_mp/meson.build | 9 + > examples/multi_process/simple_mp/Makefile | 12 +- > examples/multi_process/simple_mp/meson.build | 9 + > .../multi_process/simple_mp/mp_commands.c | 106 +--- > .../multi_process/simple_mp/mp_commands.h | 14 - > .../multi_process/simple_mp/mp_commands.list | 3 + > 20 files changed, 745 insertions(+), 422 deletions(-) Interesting series. So if we remove the doc addition, this patch is removing loc, so +1 from me= :-). There is a problem though with externally building the examples. Maybe the dpdk-cmdline-gen.py has not been exported in the install process. > create mode 100755 buildtools/dpdk-cmdline-gen.py > create mode 100644 doc/guides/prog_guide/cmdline.rst > create mode 100644 examples/bond/commands.list > delete mode 100644 examples/bond/main.h > delete mode 100644 examples/multi_process/hotplug_mp/commands.h > create mode 100644 examples/multi_process/hotplug_mp/commands.list > delete mode 100644 examples/multi_process/simple_mp/mp_commands.h > create mode 100644 examples/multi_process/simple_mp/mp_commands.list > > -- > 2.39.2 > --=20 David Marchand