File pm-profiler_cmd.patch of Package pm-profiler

Adjust code to report correct usage. Exit script in case of no
action argument given.


--- pm-profiler-0.1_20111222/tools/pm-profiler.orig	2015-01-08 23:01:53.942909038 +0100
+++ pm-profiler-0.1_20111222/tools/pm-profiler	2015-01-09 00:13:40.668682390 +0100
@@ -41,11 +41,11 @@
     echo "Usage: pm-profiler [OPTIONS]"
     echo
     echo " Profiles:"
-    echo -e "\t -x, --list-profiles\t\t show all available profiles"
-    echo -e "\t -X, --show-profile-description\t show profile description"
-    echo -e "\t -g, --get-active-profile\t get the currently active profile"
-    echo -e "\t -l, --list-current-settings\t get the currently active settings"
-    echo -e "\t -e <x>, --set-active-profile <x> switch currently active profile"
+    echo -e "\t -x, --list-profiles\t\t\t show all available profiles"
+    echo -e "\t -X <x>, --show-profile-description <x>\t show profile description"
+    echo -e "\t -g, --get-active-profile\t\t get the currently active profile"
+    echo -e "\t -l, --list-current-settings\t\t get the currently active settings"
+    echo -e "\t -e <x>, --set-active-profile <x>\t switch currently active profile"
     echo
 }
 
@@ -54,7 +54,9 @@
 help,list-profiles,show-profile-description:,get-active-profile,list-current-settings -- "$@"`
 
 if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
-   
+
+if [ $# -eq 0 ] ; then usage ; exit ; fi
+
 # Note the quotes around `$TEMP': they are essential!
 eval set -- "$TEMP"
 
@@ -66,7 +68,7 @@
         -g|--get-active-profile) get_active_profile ; shift ;;
         -l|--list-current-settings) list_current_settings ; shift ;;
 	-h|--help) usage ; shift ;;
-        --) shift ; break ;;
+        --) shift ; if [ $# -ne 0 ] ; then usage ; fi ; exit ;;
         *) echo "Internal error!" ; exit 1 ;;
     esac
 done
openSUSE Build Service is sponsored by