DPDK CI discussions
 help / color / mirror / Atom feed
From: Aaron Conole <aconole@redhat.com>
To: ci@dpdk.org
Cc: Michael Santana <msantana@redhat.com>,
	David Marchand <dmarchan@redhat.com>,
	Thomas Monjalon <thomas@monjalon.net>,
	Patrick Robb <probb@iol.unh.edu>,
	Dumitru Ceara <dceara@redhat.com>
Subject: [RFC v2 1/3] pw_mon: improve command line options
Date: Tue,  7 Nov 2023 15:31:56 -0500	[thread overview]
Message-ID: <20231107203158.1261199-2-aconole@redhat.com> (raw)
In-Reply-To: <20231107203158.1261199-1-aconole@redhat.com>

In the future, we'll use this to add support for passing opts into some parts
of pw_mon.

Signed-off-by: Aaron Conole <aconole@redhat.com>
---
 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" != "" ]; 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=<proj>		Project name"
+        echo "  instance|--pw-instance=<inst url>	URL for pw"
+        echo ""
+        echo "Options:"
+        echo "    --pw-credentials=u:p		Sets user / password for web client"
+        echo "    --add-filter-recheck=filter	Adds a filter to flag that 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" != "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


  reply	other threads:[~2023-11-07 20:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-07 20:31 [RFC v2 0/3] Add a recheck framework to pw-ci Aaron Conole
2023-11-07 20:31 ` Aaron Conole [this message]
2023-11-17 16:26   ` [RFC v2 1/3] pw_mon: improve command line options Michael Santana
2023-11-17 19:28     ` Aaron Conole
2023-11-07 20:31 ` [RFC v2 2/3] recheck: Add a recheck parser for patchwork comments Aaron Conole
2023-11-09 20:45   ` Dumitru Ceara
2023-11-10 14:05     ` Aaron Conole
2023-11-17 16:35   ` Michael Santana
2023-11-17 19:28     ` Aaron Conole
2023-11-07 20:31 ` [RFC v2 3/3] github: add a tool for restarting checks Aaron Conole
2023-11-17 16:47   ` Michael Santana
2023-11-17 19:31     ` Aaron Conole
2023-11-17 22:20       ` Michael Santana

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231107203158.1261199-2-aconole@redhat.com \
    --to=aconole@redhat.com \
    --cc=ci@dpdk.org \
    --cc=dceara@redhat.com \
    --cc=dmarchan@redhat.com \
    --cc=msantana@redhat.com \
    --cc=probb@iol.unh.edu \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).