Rename PLUMB_NOOPEN to PLUMB_OPEN and always export it - plumb - Open certain URL patterns with an ad-hoc opener (plumber)
 (HTM) hg clone https://bitbucket.org/iamleot/plumb
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
       ---
 (DIR) changeset 24384fa8fcc858732a4d0258e38daade8025356d
 (DIR) parent 4d709d70cde2328e95b58c955b38d29b94060006
 (HTM) Author: Leonardo Taccari <iamleot@gmail.com>
       Date:   Thu, 13 Sep 2018 15:39:44 
       
       Rename PLUMB_NOOPEN to PLUMB_OPEN and always export it
       
       (NO* variables are just confusing!)
       
       Diffstat:
        openers/ftp     |  2 +-
        openers/git     |  2 +-
        openers/gopher  |  2 +-
        openers/image   |  2 +-
        openers/mailto  |  2 +-
        openers/media   |  2 +-
        openers/nntp    |  2 +-
        openers/pdf     |  2 +-
        openers/reddit  |  2 +-
        openers/txt     |  2 +-
        openers/txtweb  |  2 +-
        openers/web     |  2 +-
        openers/xdgopen |  2 +-
        plumb           |  9 +++++----
        14 files changed, 18 insertions(+), 17 deletions(-)
       ---
       diff -r 4d709d70cde2 -r 24384fa8fcc8 openers/ftp
       --- a/openers/ftp       Thu Sep 13 14:47:28 2018 +0200
       +++ b/openers/ftp       Thu Sep 13 15:39:44 2018 +0200
       @@ -1,7 +1,7 @@
        #!/bin/sh
        
        for u in "$@"; do
       -       if [ "${PLUMB_NOOPEN}" = "no" ]; then
       +       if [ "${PLUMB_OPEN}" = "yes" ]; then
                       tmux new-window "w3m \"$u\""
               fi
        done
       diff -r 4d709d70cde2 -r 24384fa8fcc8 openers/git
       --- a/openers/git       Thu Sep 13 14:47:28 2018 +0200
       +++ b/openers/git       Thu Sep 13 15:39:44 2018 +0200
       @@ -4,7 +4,7 @@
        cd ${XDG_CACHE_HOME:-~/.cache}/gitcache
        
        for u in "$@"; do
       -       if [ "${PLUMB_NOOPEN}" = "no" ]; then
       +       if [ "${PLUMB_OPEN}" = "yes" ]; then
                       tmux new-window \; send-keys 'C-l' \; send-keys -l "git clone $u"
               fi
        done
       diff -r 4d709d70cde2 -r 24384fa8fcc8 openers/gopher
       --- a/openers/gopher    Thu Sep 13 14:47:28 2018 +0200
       +++ b/openers/gopher    Thu Sep 13 15:39:44 2018 +0200
       @@ -1,7 +1,7 @@
        #!/bin/sh
        
        for u in "$@"; do
       -       if [ "${PLUMB_NOOPEN}" = "no" ]; then
       +       if [ "${PLUMB_OPEN}" = "yes" ]; then
                       tmux new-window "sacc \"$u\""
               fi
        done
       diff -r 4d709d70cde2 -r 24384fa8fcc8 openers/image
       --- a/openers/image     Thu Sep 13 14:47:28 2018 +0200
       +++ b/openers/image     Thu Sep 13 15:39:44 2018 +0200
       @@ -6,7 +6,7 @@
        cd ${XDG_CACHE_HOME:-~/.cache}/imagecache
        
        for u in "$@"; do
       -       if [ "${PLUMB_NOOPEN}" = "no" ]; then
       +       if [ "${PLUMB_OPEN}" = "yes" ]; then
                       f=$(basename "$u")
                       f="${f%%\?*}"
                       curl -gs --user-agent "${PLUMB_UA}" -Lz "$f" -o "$f" "$u"
       diff -r 4d709d70cde2 -r 24384fa8fcc8 openers/mailto
       --- a/openers/mailto    Thu Sep 13 14:47:28 2018 +0200
       +++ b/openers/mailto    Thu Sep 13 15:39:44 2018 +0200
       @@ -1,7 +1,7 @@
        #!/bin/sh
        
        for u in "$@"; do
       -       if [ "${PLUMB_NOOPEN}" = "no" ]; then
       +       if [ "${PLUMB_OPEN}" = "yes" ]; then
                       to="${u#*://}"
                       tmux new-window "comp -to \"${to}\""
               fi
       diff -r 4d709d70cde2 -r 24384fa8fcc8 openers/media
       --- a/openers/media     Thu Sep 13 14:47:28 2018 +0200
       +++ b/openers/media     Thu Sep 13 15:39:44 2018 +0200
       @@ -1,7 +1,7 @@
        #!/bin/sh
        
        for u in "$@"; do
       -       if [ "${PLUMB_NOOPEN}" = "no" ]; then
       +       if [ "${PLUMB_OPEN}" = "yes" ]; then
                       tmux new-window "mpv \"$u\""
               fi
        done
       diff -r 4d709d70cde2 -r 24384fa8fcc8 openers/nntp
       --- a/openers/nntp      Thu Sep 13 14:47:28 2018 +0200
       +++ b/openers/nntp      Thu Sep 13 15:39:44 2018 +0200
       @@ -1,7 +1,7 @@
        #!/bin/sh
        
        for u in "$@"; do
       -       if [ "${PLUMB_NOOPEN}" = "no" ]; then
       +       if [ "${PLUMB_OPEN}" = "yes" ]; then
                       tmux new-window "w3m \"$u\""
               fi
        done
       diff -r 4d709d70cde2 -r 24384fa8fcc8 openers/pdf
       --- a/openers/pdf       Thu Sep 13 14:47:28 2018 +0200
       +++ b/openers/pdf       Thu Sep 13 15:39:44 2018 +0200
       @@ -6,7 +6,7 @@
        cd ${XDG_CACHE_HOME:-~/.cache}/pdfcache
        
        for u in "$@"; do
       -       if [ "${PLUMB_NOOPEN}" = "no" ]; then
       +       if [ "${PLUMB_OPEN}" = "yes" ]; then
                       f=$(basename "$u")
                       curl -gs --user-agent "${PLUMB_UA}" -Lz "$f" -O "$u"
                       xdg-open "$f" >/dev/null 2>&1 &
       diff -r 4d709d70cde2 -r 24384fa8fcc8 openers/reddit
       --- a/openers/reddit    Thu Sep 13 14:47:28 2018 +0200
       +++ b/openers/reddit    Thu Sep 13 15:39:44 2018 +0200
       @@ -1,7 +1,7 @@
        #!/bin/sh
        
        for u in "$@"; do
       -       if [ "${PLUMB_NOOPEN}" = "no" ]; then
       +       if [ "${PLUMB_OPEN}" = "yes" ]; then
                       tmux new-window "rtv \"$u\""
               fi
        done
       diff -r 4d709d70cde2 -r 24384fa8fcc8 openers/txt
       --- a/openers/txt       Thu Sep 13 14:47:28 2018 +0200
       +++ b/openers/txt       Thu Sep 13 15:39:44 2018 +0200
       @@ -3,7 +3,7 @@
        : ${PAGER:=more}
        
        for u in "$@"; do
       -       if [ "${PLUMB_NOOPEN}" = "no" ]; then
       +       if [ "${PLUMB_OPEN}" = "yes" ]; then
                       tmux new-window "curl -gLs \"$u\" | ${PAGER}"
               fi
        done
       diff -r 4d709d70cde2 -r 24384fa8fcc8 openers/txtweb
       --- a/openers/txtweb    Thu Sep 13 14:47:28 2018 +0200
       +++ b/openers/txtweb    Thu Sep 13 15:39:44 2018 +0200
       @@ -1,7 +1,7 @@
        #!/bin/sh
        
        for u in "$@"; do
       -       if [ "${PLUMB_NOOPEN}" = "no" ]; then
       +       if [ "${PLUMB_OPEN}" = "yes" ]; then
                       tmux new-window "w3m \"$u\""
               fi
        done
       diff -r 4d709d70cde2 -r 24384fa8fcc8 openers/web
       --- a/openers/web       Thu Sep 13 14:47:28 2018 +0200
       +++ b/openers/web       Thu Sep 13 15:39:44 2018 +0200
       @@ -1,7 +1,7 @@
        #!/bin/sh
        
        for u in "$@"; do
       -       if [ "${PLUMB_NOOPEN}" = "no" ]; then
       +       if [ "${PLUMB_OPEN}" = "yes" ]; then
                       xdg-open "$u" >/dev/null 2>&1 &
               fi
        done
       diff -r 4d709d70cde2 -r 24384fa8fcc8 openers/xdgopen
       --- a/openers/xdgopen   Thu Sep 13 14:47:28 2018 +0200
       +++ b/openers/xdgopen   Thu Sep 13 15:39:44 2018 +0200
       @@ -1,7 +1,7 @@
        #!/bin/sh
        
        for u in "$@"; do
       -       if [ "${PLUMB_NOOPEN}" = "no" ]; then
       +       if [ "${PLUMB_OPEN}" = "yes" ]; then
                       xdg-open "$u" >/dev/null 2>&1 &
               fi
        done
       diff -r 4d709d70cde2 -r 24384fa8fcc8 plumb
       --- a/plumb     Thu Sep 13 14:47:28 2018 +0200
       +++ b/plumb     Thu Sep 13 15:39:44 2018 +0200
       @@ -30,7 +30,7 @@
        
        : ${PLUMB_OPENERS_PATH:=${HOME}/.plumb/openers}
        : ${PLUMB_RULES:=${HOME}/.plumb/rules}
       -: ${PLUMB_NOOPEN:=no}
       +: ${PLUMB_OPEN:=yes}
        
        
        #
       @@ -52,9 +52,10 @@
               opener="$1"
               url="$2"
        
       -       if [ "${PLUMB_NOOPEN}" = "yes" ]; then
       +       export PLUMB_OPEN
       +
       +       if [ "${PLUMB_OPEN}" = "no" ]; then
                       echo "${opener} \"${url}\""
       -               export PLUMB_NOOPEN=yes
               fi
        
               ${PLUMB_OPENERS_PATH}/${opener} "${url}"
       @@ -72,7 +73,7 @@
        
               while getopts n f; do
                       case $f in
       -                       n) PLUMB_NOOPEN="yes";;
       +                       n) PLUMB_OPEN="no";;
                               ?) usage;;
                       esac
               done