* Removed dilod(1) based menu alternative.
authorUrban Wallasch <urban.wallasch@freenet.de>
Sat, 18 Apr 2020 09:58:46 +0000 (11:58 +0200)
committerUrban Wallasch <urban.wallasch@freenet.de>
Sat, 18 Apr 2020 09:58:46 +0000 (11:58 +0200)
* Bumped version to 2.02.

XbpsUI.sh

index ac29943ecad6040971387d0cc3d06c1f0e518790..01a4272f482d2383d3dd1d320d262e42243eba23 100755 (executable)
--- a/XbpsUI.sh
+++ b/XbpsUI.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-verstr="XbpsUI 2.0.1"
+verstr="XbpsUI 2.0.2"
 
 # Evaluate command line:
 for arg in "$@" ; do
@@ -9,12 +9,8 @@ for arg in "$@" ; do
             echo "$verstr"
             exit 0
             ;; 
-        "-d")
-            use_dialog=1
-            ;;
         "-h"|*)
-            echo "Usage:  $(basename $0) [-d] [-h] [-V]"
-            echo "    -d  use dialog(1) to display the main menu, not fzf(1)"
+            echo "Usage:  $(basename $0) [-h] [-V]"
             echo "    -h  display this help page"
             echo "    -V  display version info and exit"
             exit 0
@@ -45,7 +41,6 @@ fi
 # Check/install essential prerequisites:
 pinst=""
 preq="fzf gawk"
-[[ "$use_dialog" == "1" ]] && preq="dialog $preq"
 for cmd in $preq ; do
     if ! command -pv "$cmd" > /dev/null ; then
         pinst="$pinst $cmd"
@@ -83,36 +78,6 @@ function trapWithArg() {
 
 trapWithArg cleanup EXIT SIGINT SIGTERM SIGQUIT SIGHUP
 
-
-# Create resource file for dialog:
-if [[ "$use_dialog" == "1" ]] ; then
-echo "# dialogrc
-use_colors = ON
-use_shadow = OFF
-screen_color = (WHITE,BLACK,ON)
-shadow_color = (BLACK,BLACK,OFF)
-dialog_color = (WHITE,BLACK,OFF)
-title_color = (WHITE,BLACK,ON)
-border_color = (BLACK,BLACK,ON)
-button_active_color = (BLACK,WHITE,ON)
-button_inactive_color = dialog_color
-button_key_active_color = button_active_color
-button_key_inactive_color = (RED,BLACK,ON)
-button_label_active_color = (BLACK,WHITE,ON)
-button_label_inactive_color = (WHITE,BLACK,ON)
-menubox_color = screen_color
-menubox_border_color = border_color
-item_color = dialog_color
-item_selected_color = (BLACK,WHITE,OFF)
-tag_color = title_color
-tag_selected_color = button_label_active_color
-tag_key_color = button_key_inactive_color
-tag_key_selected_color = (RED,WHITE,ON)
-border2_color = dialog_color
-menubox_border2_color = dialog_color
-" > $tmp/dialogrc
-fi
-
 # Pretty printing:
 function prmsg() {
     case "$1" in
@@ -334,45 +299,7 @@ function markPkgAuto() {
 
 # Main menu:
 function menu() {
-    if [[ -n $use_dialog ]] ; then
-        # Use dialog(1) for main menu.
-        # NOTE: Using explicit output redirection, as dialog's --stdout
-        # option allegedly might fail in unexpected ways.  Go figure.
-        exec 3>&1
-        choice=$( \
-            DIALOGRC=$tmp/dialogrc \
-            dialog \
-            --title "$verstr" \
-            --begin 1 0 \
-            --cancel-label 'Quit' \
-            --colors \
-            --no-lines \
-            --no-shadow \
-            --menu '' 19 60 15 \
-            'sync'      'Synchronize repository package database' \
-            'upgrade'   'Update all packages to their latest version' \
-            'install'   'Install a new package' \
-            'reinstall' 'Re-install an already installed package' \
-            'purge'     'Remove a currently installed package' \
-            'reconfig'  'Forcibly reconfigure an installed package' \
-            'clean'     'Remove obsolete packages from cache' \
-            'orphan'    'Remove orphaned packages' \
-            'manual'    'Mark packages as manually installed' \
-            'auto'      'Mark packages as automatically installed' \
-            'hold'      'Set packages on hold' \
-            'unhold'    'Unhold held packages' \
-            2>&1 1>&3 \
-        )
-        res=$?
-        exec 3>&-
-        clear
-        if (( $res != 0 )) ; then
-            # quit / cancel menu
-            exit 0
-        fi
-    else
-        # Use fzf(1) for main menu.
-        choice="$( echo "\
+    choice="$( echo "\
 sync        Synchronize repository package database
 upgrade     Update all packages to their latest version
 install     Install a new package
@@ -386,22 +313,21 @@ auto        Mark packages as automatically installed
 hold        Set packages on hold
 unhold      Unhold held packages
 quit        Quit" |
-            fzf -i \
-            --no-multi \
-            --exact \
-           --bind q:abort,home:top,end:page-down \
-            --no-sort \
-            --cycle \
-            --reverse \
-            --margin="4%,1%,1%,2%" \
-            --inline-info \
-            --header=$'\n'"$verstr"$'\n\n' |
-            awk '{ print $1 }'
-        )"
-        if [[ -z "$choice" ]] ; then
-            # quit / cancel menu
-            exit 0
-        fi
+       fzf -i \
+       --no-multi \
+       --exact \
+       --bind q:abort,home:top,end:page-down \
+       --no-sort \
+       --cycle \
+       --reverse \
+       --margin="4%,1%,1%,2%" \
+       --inline-info \
+       --header=$'\n'"$verstr"$'\n\n' |
+       awk '{ print $1 }'
+    )"
+    if [[ -z "$choice" ]] ; then
+       # quit / cancel menu
+       exit 0
     fi
     
     # Perform requested action:
@@ -421,7 +347,7 @@ quit        Quit" |
         "hold" )       holdPkg       ;;
         "unhold" )     unholdPkg     ;;
         "quit" )       exit 0        ;;
-        * )            echo "Action not implemented, WTF!?!" ; false ;;
+        * )            echo "$choice: Action not implemented, WTF!?!" ; false ;;
     esac
     return $?
 }