change how mounts are listed

This commit is contained in:
Q
2024-09-08 20:05:44 +03:00
parent 523a61ee80
commit 71e155fcde
2 changed files with 23 additions and 10 deletions

View File

@@ -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
}
_menu() {
_current_mounts() {
echo Current mounts:
cat /proc/mounts | grep fuse.rclone | awk '{ print $1 "\t" $2 }'
cat /proc/mounts | grep fuse.rclone | awk '{ print $1 " " $2 }' | sed "s,$HOME,~," | xargs printf "%15s %s\n"
}
_menu() {
_current_mounts
_askpass
choice=$( rclone --ask-password=false listremotes | \
sort | \

View File

@@ -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
}
_menu() {
_current_mounts() {
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 | \
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() {
_current_mounts
choice=$( _hosts | \
smenu -t 1 -a c:0/2 i:3 -n 25 -m "Select server" \
-N -D n:1 i:1 )