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 29514433F8; Tue, 28 Nov 2023 22:02:02 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0694D42DDD; Tue, 28 Nov 2023 22:02:02 +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 C0209410FD for ; Tue, 28 Nov 2023 22:01:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701205319; 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=TdBPTP5SNrJJvQmvFb1uWuXLAZfFpcHkafN6tohPJYI=; b=eEFloH+d0MkT2068ed/iPj33pr01BoG778BfmKixeRZzDXcHexUIpp3HKkNLMB3y+xpBLM rXZnyY8aifSGcs8s53X3znrKWy7xMwQkiNX36kJSy5i8PpYcdpNwqT2NUnBWBeQm6xfN4V W3h+hU8lTUj2JKPln/S8HhmDRD2lEfY= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-195-njIMGyZ3OzierxKZzmXgkQ-1; Tue, 28 Nov 2023 16:01:57 -0500 X-MC-Unique: njIMGyZ3OzierxKZzmXgkQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (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 24FA5381CC03; Tue, 28 Nov 2023 21:01:57 +0000 (UTC) Received: from RHTPC1VM0NT.lan (unknown [10.22.32.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id C5BF640C6E83; Tue, 28 Nov 2023 21:01:56 +0000 (UTC) From: Aaron Conole To: ci@dpdk.org Cc: Michael Santana , David Marchand , Thomas Monjalon , Patrick Robb , Dumitru Ceara Subject: [PATCH v3 1/3] pw_mon: improve command line options Date: Tue, 28 Nov 2023 16:01:52 -0500 Message-ID: <20231128210155.1388785-2-aconole@redhat.com> In-Reply-To: <20231128210155.1388785-1-aconole@redhat.com> References: <20231128210155.1388785-1-aconole@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 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. Acked-by: Michael Santana Signed-off-by: Aaron Conole --- pw_mon | 64 +++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 50 insertions(+), 14 deletions(-) diff --git a/pw_mon b/pw_mon index 28feb8b..e1c1eab 100755 --- a/pw_mon +++ b/pw_mon @@ -21,34 +21,70 @@ [ -f "${HOME}/.pwmon-rc" ] && source "${HOME}/.pwmon-rc" -if [ "$1" != "" ]; then - pw_project="$1" - shift +if [ "$1" != "" ]; then + if ! echo "$1" | grep -q -s -E ^-- ; 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 -q -s -E ^-- ; then + pw_instance="$1" + shift + fi fi userpw="" if [ "$1" != "" ]; then - pw_credential="$1" + if ! echo "$1" | grep -q -s -E ^-- ; then + pw_credential="$1" + shift + fi fi + +while [ "$1" != "" ]; do + if echo "$1" | grep -q -s -E ^--pw-project= ; then + pw_project=$(echo "$1" | sed s/^--pw-project=//) + shift + elif echo "$1" | grep -q -s -E ^--pw-instance= ; then + pw_instance=$(echo "$1" | sed s/^--pw-instance=//) + shift + elif echo "$1" | grep -q -s -E ^--pw-credentials= ; then + pw_credential=$(echo "$1" | sed s/^--pw-credentials=//) + 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= Project name" + echo " instance|--pw-instance= URL for pw" + echo "" + echo "Options:" + echo " --pw-credentials=u:p Sets user / password for web client" + echo "" + exit 0 + else + echo "Unknown option: '$1'" + echo "Rerun with --help for details" + exit 1 + fi +done + if [ "X$pw_credential" != "X" ]; then userpw="-u \"${pw_credential}\"" 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 +fi + source $(dirname $0)/series_db_lib.sh function emit_series() { -- 2.41.0