diff --git a/web/rclone-mount b/web/rclone-mount index 379309c..0f04b73 100755 --- a/web/rclone-mount +++ b/web/rclone-mount @@ -8,14 +8,18 @@ _helpexit() { -u will unmount all FUSE.rclone paths if no path given! " "$( basename $0 )" - echo Current mounts: - cat /proc/mounts | grep fuse.rclone | awk '{ print $1 "\t" $2 }' + _current_mounts exit 1 } +_current_mounts() { + echo Current mounts: + cat /proc/mounts | grep fuse.rclone | awk '{ print $1 " " $2 }' | sed "s,$HOME,~," | xargs printf "%15s %s\n" +} + + _menu() { - echo Current mounts: - cat /proc/mounts | grep fuse.rclone | awk '{ print $1 "\t" $2 }' + _current_mounts _askpass choice=$( rclone --ask-password=false listremotes | \ sort | \ diff --git a/web/sshfs-mount b/web/sshfs-mount index 1dc1d0b..45c72df 100755 --- a/web/sshfs-mount +++ b/web/sshfs-mount @@ -11,16 +11,25 @@ _helpexit() { -nofollow disable symlinks following " "$( basename $0 )" - echo Current mounts: - cat /proc/mounts | grep fuse.sshfs | awk '{ print $1 "\t" $2 }' + _current_mounts exit 1 } +_current_mounts() { + echo Current mounts: + cat /proc/mounts | grep fuse.sshfs | awk '{ print $1 " " $2 }' | sed "s,$HOME,~," | xargs printf "%15s %s\n" +} + +_hosts() { + { + grep -Pi -e "^host ([^*]+)$" $HOME/.ssh/config | grep -e "#.sshfs"; + grep -Pi -e "^host ([^*]+)$" $HOME/.ssh/config | grep -v -e "#.sshfs"; + } | awk '{ print $2 }' | tr ' ' '\n' | grep -vie "^host$" -e "*" -e "^$"; +} + _menu() { - echo Current mounts: - cat /proc/mounts | grep fuse.sshfs | awk '{ print $1 "\t" $2 }' - choice=$( grep -Pi "^host ([^*]+)$" $HOME/.ssh/config | \ - sed 's/host //i' | tr ' ' '\n' | sort | \ + _current_mounts + choice=$( _hosts | \ smenu -t 1 -a c:0/2 i:3 -n 25 -m "Select server" \ -N -D n:1 i:1 )