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 8862043355; Fri, 17 Nov 2023 17:26:35 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6D7CE411F3; Fri, 17 Nov 2023 17:26:35 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 757B4402EA for ; Fri, 17 Nov 2023 17:26:34 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700238393; 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=TJznOLuG4Gv8IwWhgBBbMwv3TrIdk1UOzzrGu6RJISE=; b=iBMV2HIHeRcw30bksWk/DEvQXeoHaZSkT3uK0NrfWxK5cdFsJ+7j2hyTLBvRfL82LrOaZS uYJjE7E/T9b50QQ3WLZZ0CDRx9oeXXWZTvbjfrmmnLbTJ/UPDDsjC6dw2jVGyYDF5MbJH8 032UrMJua0eJ81Sl/H5wBOk+Mcwk8qc= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-457-IkITqYphNXGEhi9DBWzUWA-1; Fri, 17 Nov 2023 11:26:32 -0500 X-MC-Unique: IkITqYphNXGEhi9DBWzUWA-1 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-9e61e969b19so159348166b.2 for ; Fri, 17 Nov 2023 08:26:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700238391; x=1700843191; 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=TJznOLuG4Gv8IwWhgBBbMwv3TrIdk1UOzzrGu6RJISE=; b=bCHlapRSuITZJeWgaDD92mjwnkn12cCyi4O97U4EUyTg9kzNiXuBeaiydUlquazZUb f2X72Qa7dRWyQeLajNv5RpnouYvRoJHduSuRmnT6ZRzBQN3bA9LeqxTKnOwEoOjoxypS rz2T2afcI1lYvZSehgNx2vDuHBlKMtJ4XalC+7/Dl/ReUbvhqIZGjSswjTh0egbmmYMg USSCed9pBmMA8U/qsSnUuP1dGUlgG/gipCbUtvvkmK6XF/hs1X4Sl8+j/1Kmb5q8q2VJ WnV95o8zP+oJIITFQnbu9AXs3g/pwCHxnc28PW5gnEVEzSXDrIJrk8T/01MUrEatJVky tODA== X-Gm-Message-State: AOJu0YzYoFcfxm1um5/izucJRZLeMRpU50A79LmjergYohzibd7Ess/6 /Sd6jyUOnuHgFCbHx3EAvfIfQ/j1sJt45P7TpHMHEH858vbAzq9lIBwdZSnXpEH3tBsyr1wWYsJ 8fuv5WGx+helkAP29BA== X-Received: by 2002:a17:906:1602:b0:9c3:b3cb:29ae with SMTP id m2-20020a170906160200b009c3b3cb29aemr14339262ejd.47.1700238391601; Fri, 17 Nov 2023 08:26:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IHMcnyNBLxmTBlO47p3LL562yju8l9OF/YxUh37aIFJjNwQVQkaXMJgRO6jLjqTiEO/WP1YOBiSUF6/LYDFQlQ= X-Received: by 2002:a17:906:1602:b0:9c3:b3cb:29ae with SMTP id m2-20020a170906160200b009c3b3cb29aemr14339245ejd.47.1700238391203; Fri, 17 Nov 2023 08:26:31 -0800 (PST) MIME-Version: 1.0 References: <20231107203158.1261199-1-aconole@redhat.com> <20231107203158.1261199-2-aconole@redhat.com> In-Reply-To: <20231107203158.1261199-2-aconole@redhat.com> From: Michael Santana Date: Fri, 17 Nov 2023 11:26:19 -0500 Message-ID: Subject: Re: [RFC v2 1/3] pw_mon: improve command line options To: Aaron Conole Cc: ci@dpdk.org, David Marchand , Thomas Monjalon , Patrick Robb , Dumitru Ceara X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: ci@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK CI discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ci-bounces@dpdk.org On Tue, Nov 7, 2023 at 3:32=E2=80=AFPM Aaron Conole wr= ote: > > In the future, we'll use this to add support for passing opts into some p= arts > of pw_mon. > > Signed-off-by: Aaron Conole Acked-by: Michael Santana > --- > pw_mon | 65 +++++++++++++++++++++++++++++++++++++++++++++------------- > 1 file changed, 51 insertions(+), 14 deletions(-) > > diff --git a/pw_mon b/pw_mon > index 28feb8b..da4b9a9 100755 > --- a/pw_mon > +++ b/pw_mon > @@ -21,34 +21,71 @@ > > [ -f "${HOME}/.pwmon-rc" ] && source "${HOME}/.pwmon-rc" > > -if [ "$1" !=3D "" ]; then > - pw_project=3D"$1" > - shift > +if [ "$1" !=3D "" ]; then > + if ! echo "$1" | grep -q -s -E ^-- ; then The missing quotes give me OCD, but I'll let it pass :) It is technically correct apparently. It worked when I tested it. I guess I am so used to using grep with quotes that I had never considered that there was a whole world where people use grep without quotes :P > + pw_project=3D"$1" > + shift > + fi > fi > > if [ "$1" !=3D "" ]; then > - pw_instance=3D"$1" > - shift > -fi > - > -if [ "X$pw_instance" =3D=3D "X" -o "X$pw_project" =3D=3D "X" ]; then > - echo "ERROR: Patchwork instance and project are unset." > - echo "Please setup ${HOME}/.pwmon-rc and set pw_project " > - echo "(or pass it as an argument)." > - echo "Also either setup pw_instance or pass it as an argument." > - exit 1 > + if ! echo "$1" | grep -q -s -E ^-- ; then > + pw_instance=3D"$1" > + shift > + fi > fi > > userpw=3D"" > > if [ "$1" !=3D "" ]; then > - pw_credential=3D"$1" > + if ! echo "$1" | grep -q -s -E ^-- ; then > + pw_credential=3D"$1" > + shift > + fi > fi > > + > +while [ "$1" !=3D "" ]; do > + if echo "$1" | grep -q -s -E ^--pw-project=3D ; then > + pw_project=3D$(echo "$1" | sed s/^--pw-project=3D//) > + shift > + elif echo "$1" | grep -q -s -E ^--pw-instance=3D ; then > + pw_instance=3D$(echo "$1" | sed s/^--pw-instance=3D//) > + shift > + elif echo "$1" | grep -q -s -E ^--pw-credentials=3D ; then > + pw_credential=3D$(echo "$1" | sed s/^--pw-credentials=3D//) > + shift > + elif echo "$1" | grep -E ^--help >/dev/null 2>&1; then > + echo "patchwork monitor script" > + echo "$0: args" > + echo "Required if not set in ~/.pwmon-rc file:" > + echo " proj|--pw-project=3D Project name" > + echo " instance|--pw-instance=3D URL for pw" > + echo "" > + echo "Options:" > + echo " --pw-credentials=3Du:p Sets user / password fo= r web client" > + echo " --add-filter-recheck=3Dfilter Adds a filter to flag t= hat a recheck needs to be done" > + echo "" > + exit 0 > + else > + echo "Unknown option: '$1'" > + echo "Rerun with --help for details" > + exit 1 > + fi > +done > + > if [ "X$pw_credential" !=3D "X" ]; then > userpw=3D"-u \"${pw_credential}\"" > fi > > +if [ "X$pw_instance" =3D=3D "X" -o "X$pw_project" =3D=3D "X" ]; then > + echo "ERROR: Patchwork instance and project are unset." > + echo "Please setup ${HOME}/.pwmon-rc and set pw_project " > + echo "(or pass it as an argument)." > + echo "Also either setup pw_instance or pass it as an argument." > + exit 1 > +fi > + > source $(dirname $0)/series_db_lib.sh > > function emit_series() { > -- > 2.41.0 >