]> Sergey Matveev's repositories - nnn.git/commitdiff
mocplay: confirm working with selection
authorArun Prakash Jana <engineerarun@gmail.com>
Mon, 16 Sep 2019 18:05:43 +0000 (23:35 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Mon, 16 Sep 2019 18:05:43 +0000 (23:35 +0530)
plugins/mocplay

index d93536ad4a6727f42c25e2c1c36378ca1b40807b..5f37c37773bf69c195671a68ffedc9e3ee8f7f0b 100755 (executable)
@@ -20,7 +20,7 @@ SHUFFLE=0
 
 mocp_add() {
     if [ $SHUFFLE = 1 ]; then
-        if [ -s "$selection" ]; then
+        if [ "$resp" = "y" ]; then
             arr=$(tr '\0' '\n' < "$selection")
         elif [ -n "$1" ]; then
             arr="$1"
@@ -44,7 +44,7 @@ mocp_add() {
         done
 
     else
-        if [ -s "$selection" ]; then
+        if [ "$resp" = "y" ]; then
             xargs < "$selection" -0 mocp -a
         else
             mocp -a "$1"
@@ -56,6 +56,11 @@ if [ ! -s "$selection" ] && [ -z "$1" ]; then
    exit
 fi
 
+if [ -s "$selection" ]; then
+    echo -n "Work with selection? Enter 'y' to confirm: "
+    read resp
+fi
+
 if [ -z "$ret" ]; then
     # mocp not running
     mocp -S
@@ -76,7 +81,7 @@ fi
 
 # clear selection and play
 mocp -c
-mocp_add "$1"
+mocp_add "$1" "$resp"
 mocp -p
 
 # uncomment the line below to show mocp interface after appending