DPDK CI discussions
 help / color / mirror / Atom feed
* [RFC 1/2] pw_mon: improve command line options
@ 2023-10-27 13:06 Aaron Conole
  2023-10-27 13:06 ` [RFC 2/2] recheck: Add a recheck parser for patchwork comments Aaron Conole
  2023-10-31 14:45 ` [RFC 1/2] pw_mon: improve command line options Michael Santana
  0 siblings, 2 replies; 9+ messages in thread
From: Aaron Conole @ 2023-10-27 13:06 UTC (permalink / raw)
  To: Michael Santana; +Cc: Dumitru Ceara, David Marchand, Ilya Maximets, ci

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 | 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=<proj>] [instance|--pw-instance=<inst url] opts.."
+        echo "Options:"
+        echo "    --add-filter-recheck=filter	Adds a filter to flag that a recheck needs to be done"
+        echo ""
+        exit 0
+    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


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-11-02 13:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-27 13:06 [RFC 1/2] pw_mon: improve command line options Aaron Conole
2023-10-27 13:06 ` [RFC 2/2] recheck: Add a recheck parser for patchwork comments Aaron Conole
2023-11-01 16:57   ` Michael Santana
2023-11-01 19:16     ` Aaron Conole
2023-11-02 10:44       ` Thomas Monjalon
2023-11-02 13:03         ` Aaron Conole
2023-11-02 13:32           ` Thomas Monjalon
2023-10-31 14:45 ` [RFC 1/2] pw_mon: improve command line options Michael Santana
2023-10-31 15:54   ` Aaron Conole

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).