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 7699A43215; Fri, 27 Oct 2023 15:06:14 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7028E42DA6; Fri, 27 Oct 2023 15:06:14 +0200 (CEST) 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 B04AA42DA6 for ; Fri, 27 Oct 2023 15:06:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698411972; 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; bh=ZD9qcTSFNUT7cTv4j2bpKcpVU+lL66GoVUpXE+RdZxc=; b=By1XoTUk/2YcIyvND1tDQtzyIzFmBzLAWSF4ILmVL386lAduUpLr7OY/EJdECU9Lmq1Xy3 Brx28/T+gz9X1QlPxpQX4TwZmUISSpfgtgHdXEPvZWkDXh6gwcM1win4H6xfId1R0ntrKx b20f6Rxw2vaBYIZWqaUaqmGcPNMD/Lw= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-157-o8cVCjOZNliSydVgj1uVyQ-1; Fri, 27 Oct 2023 09:06:10 -0400 X-MC-Unique: o8cVCjOZNliSydVgj1uVyQ-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6D047862DCD for ; Fri, 27 Oct 2023 13:06:10 +0000 (UTC) Received: from RHTPC1VM0NT.lan (unknown [10.22.9.87]) by smtp.corp.redhat.com (Postfix) with ESMTP id 32A80492BE0; Fri, 27 Oct 2023 13:06:10 +0000 (UTC) From: Aaron Conole To: Michael Santana Cc: Dumitru Ceara , David Marchand , Ilya Maximets , ci@dpdk.org Subject: [RFC 1/2] pw_mon: improve command line options Date: Fri, 27 Oct 2023 09:06:08 -0400 Message-ID: <20231027130609.3035396-1-aconole@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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 In the future, we'll use this to add support for passing opts into some parts of pw_mon. Signed-off-by: Aaron Conole --- pw_mon | 53 +++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 39 insertions(+), 14 deletions(-) diff --git a/pw_mon b/pw_mon index 28feb8b..01bdd25 100755 --- a/pw_mon +++ b/pw_mon @@ -21,34 +21,59 @@ [ -f "${HOME}/.pwmon-rc" ] && source "${HOME}/.pwmon-rc" -if [ "$1" != "" ]; then - pw_project="$1" - shift +if [ "$1" != "" ]; then + if ! echo "$1" | grep -E ^-- >/dev/null 2>&1; then + pw_project="$1" + shift + fi fi if [ "$1" != "" ]; then - pw_instance="$1" - shift -fi - -if [ "X$pw_instance" == "X" -o "X$pw_project" == "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 -E ^-- >/dev/null 2>&1; then + pw_instance="$1" + shift + fi fi userpw="" if [ "$1" != "" ]; then - pw_credential="$1" + if ! echo "$1" | grep -E ^-- >/dev/null 2>&1; then + pw_credential="$1" + shift + fi fi + +while [ "$1" != "" ]; do + if echo "$1" | grep -E ^--pw-project= >/dev/null 2>&1; then + pw_project=$(echo "$1" | sed s/--pw-project=//) + shift + elif echo "$1" | grep -E ^--pw-instance= >/dev/null 2>&1; then + pw_instance=$(echo "$1" | sed s/--pw-instance=//) + shift + elif echo "$1" | grep -E ^--help >/dev/null 2>&1; then + echo "pw_mon script" + echo "$0 [proj|--pw-project=] [instance|--pw-instance=