aboutsummaryrefslogtreecommitdiffstats
path: root/home-manager/config/lf/cmds
diff options
context:
space:
mode:
authorene <ene@sils.li>2023-02-19 21:29:01 +0100
committerene <ene@sils.li>2023-02-19 21:30:25 +0100
commit9108d474af7776767d93eb933ff4b0b09772917a (patch)
tree0f8706dd91d9f6b9242717e482e41f8b6b24ed8e /home-manager/config/lf/cmds
parentFix(bootstrap): Fix a copy and paste oversight (diff)
downloadnixos-config-9108d474af7776767d93eb933ff4b0b09772917a.zip
Feat(lf): Add dependencies for the shell scripts
Diffstat (limited to 'home-manager/config/lf/cmds')
-rw-r--r--home-manager/config/lf/cmds/archive.sh4
-rw-r--r--home-manager/config/lf/cmds/broot_jump.sh4
-rw-r--r--home-manager/config/lf/cmds/chmod.sh4
-rw-r--r--home-manager/config/lf/cmds/clear_trash.sh7
-rw-r--r--home-manager/config/lf/cmds/dl_file.sh6
-rw-r--r--home-manager/config/lf/cmds/dragon.sh6
-rw-r--r--home-manager/config/lf/cmds/dragon_individual.sh6
-rw-r--r--home-manager/config/lf/cmds/dragon_stay.sh6
-rw-r--r--home-manager/config/lf/cmds/fzf_jump.sh4
-rw-r--r--home-manager/config/lf/cmds/help.sh5
-rw-r--r--home-manager/config/lf/cmds/mk_dir.sh4
-rw-r--r--home-manager/config/lf/cmds/mk_file.sh4
-rw-r--r--home-manager/config/lf/cmds/mk_ln.sh8
-rw-r--r--home-manager/config/lf/cmds/mk_scr.sh14
-rw-r--r--home-manager/config/lf/cmds/open.sh4
-rw-r--r--home-manager/config/lf/cmds/open_config.sh4
-rw-r--r--home-manager/config/lf/cmds/restore_trash.sh7
-rw-r--r--home-manager/config/lf/cmds/set_wall_paper.sh4
-rw-r--r--home-manager/config/lf/cmds/stripspace.sh7
-rw-r--r--home-manager/config/lf/cmds/sudo_mk_file.sh4
-rw-r--r--home-manager/config/lf/cmds/trash.sh40
-rw-r--r--home-manager/config/lf/cmds/unarchive.sh11
22 files changed, 84 insertions, 79 deletions
diff --git a/home-manager/config/lf/cmds/archive.sh b/home-manager/config/lf/cmds/archive.sh
index 48544365..d319116d 100644
--- a/home-manager/config/lf/cmds/archive.sh
+++ b/home-manager/config/lf/cmds/archive.sh
@@ -1,7 +1,7 @@
-#!/bin/sh
+#!/usr/bin/env dash
# shellcheck disable=SC2086
# shellcheck source=/home/dt/.local/lib/shell/lib
-. ~/.local/lib/shell/lib
+. %SHELL_LIBRARY_PATH
# Option '-f' disables pathname expansion which can be useful when $f, $fs, and
diff --git a/home-manager/config/lf/cmds/broot_jump.sh b/home-manager/config/lf/cmds/broot_jump.sh
index 188c9508..00d04b2b 100644
--- a/home-manager/config/lf/cmds/broot_jump.sh
+++ b/home-manager/config/lf/cmds/broot_jump.sh
@@ -1,7 +1,7 @@
-#!/bin/sh
+#!/usr/bin/env dash
# shellcheck disable=SC2086
# shellcheck source=/dev/null
-. ~/.local/lib/shell/lib
+. %SHELL_LIBRARY_PATH
f=$(mktemp)
res="$(broot --outcmd $f && cat $f | sed 's/cd //')"
diff --git a/home-manager/config/lf/cmds/chmod.sh b/home-manager/config/lf/cmds/chmod.sh
index f6a87336..c7bb6ff8 100644
--- a/home-manager/config/lf/cmds/chmod.sh
+++ b/home-manager/config/lf/cmds/chmod.sh
@@ -1,7 +1,7 @@
-#!/bin/sh
+#!/usr/bin/env dash
# shellcheck disable=SC2086
# shellcheck source=/dev/null
-. ~/.local/lib/shell/lib
+. %SHELL_LIBRARY_PATH
readp "Mode Bits: " ans
diff --git a/home-manager/config/lf/cmds/clear_trash.sh b/home-manager/config/lf/cmds/clear_trash.sh
index c02321f2..d732756f 100644
--- a/home-manager/config/lf/cmds/clear_trash.sh
+++ b/home-manager/config/lf/cmds/clear_trash.sh
@@ -1,10 +1,11 @@
-#!/bin/sh
+#!/usr/bin/env dash
# shellcheck disable=SC2086
# shellcheck source=/dev/null
-. ~/.local/lib/shell/lib
+. %SHELL_LIBRARY_PATH
-trash-empty
+# could also use --force, for instand removal
+trash list | fzf --multi | awk '{print $NF}' | xargs trash empty --match=exact
if [ -d /tmp/LIB_FILE_TEMP_DIR/ ];then rm -r /tmp/LIB_FILE_TEMP_DIR/; fi
diff --git a/home-manager/config/lf/cmds/dl_file.sh b/home-manager/config/lf/cmds/dl_file.sh
index 9cb9023c..ac6d6ded 100644
--- a/home-manager/config/lf/cmds/dl_file.sh
+++ b/home-manager/config/lf/cmds/dl_file.sh
@@ -1,11 +1,11 @@
-#!/bin/sh
+#!/usr/bin/env dash
# shellcheck disable=SC2086
# shellcheck source=/dev/null
-. ~/.local/lib/shell/lib
+. %SHELL_LIBRARY_PATH
# Provides the ability to download a file by dropping it into a window
-url=$(dragon-drop -t -x)
+url=$(dragon -t -x)
if [ -n "$url" ]; then
printf "File Name: "
diff --git a/home-manager/config/lf/cmds/dragon.sh b/home-manager/config/lf/cmds/dragon.sh
index 36e94706..be91a951 100644
--- a/home-manager/config/lf/cmds/dragon.sh
+++ b/home-manager/config/lf/cmds/dragon.sh
@@ -1,9 +1,9 @@
-#!/bin/sh
+#!/usr/bin/env dash
# shellcheck disable=SC2086
# shellcheck source=/dev/null
-. ~/.local/lib/shell/lib
+. %SHELL_LIBRARY_PATH
-dragon-drop -a -x "$fx"
+dragon -a -x "$fx"
diff --git a/home-manager/config/lf/cmds/dragon_individual.sh b/home-manager/config/lf/cmds/dragon_individual.sh
index abcadb13..8215a20b 100644
--- a/home-manager/config/lf/cmds/dragon_individual.sh
+++ b/home-manager/config/lf/cmds/dragon_individual.sh
@@ -1,9 +1,9 @@
-#!/bin/sh
+#!/usr/bin/env dash
# shellcheck disable=SC2086
# shellcheck source=/dev/null
-. ~/.local/lib/shell/lib
+. %SHELL_LIBRARY_PATH
-dragon-drop "$fx"
+dragon "$fx"
diff --git a/home-manager/config/lf/cmds/dragon_stay.sh b/home-manager/config/lf/cmds/dragon_stay.sh
index 60195d09..bf5bb7dd 100644
--- a/home-manager/config/lf/cmds/dragon_stay.sh
+++ b/home-manager/config/lf/cmds/dragon_stay.sh
@@ -1,9 +1,9 @@
-#!/bin/sh
+#!/usr/bin/env dash
# shellcheck disable=SC2086
# shellcheck source=/dev/null
-. ~/.local/lib/shell/lib
+. %SHELL_LIBRARY_PATH
-dragon-drop -a "$fx"
+dragon -a "$fx"
diff --git a/home-manager/config/lf/cmds/fzf_jump.sh b/home-manager/config/lf/cmds/fzf_jump.sh
index 688efdb9..7e3bb9d0 100644
--- a/home-manager/config/lf/cmds/fzf_jump.sh
+++ b/home-manager/config/lf/cmds/fzf_jump.sh
@@ -1,7 +1,7 @@
-#!/bin/sh
+#!/usr/bin/env dash
# shellcheck disable=SC2086
# shellcheck source=/dev/null
-. ~/.local/lib/shell/lib
+. %SHELL_LIBRARY_PATH
res="$(find . -maxdepth 3 | fzf --reverse --header='Jump to location')"
if [ -f "$res" ]; then
diff --git a/home-manager/config/lf/cmds/help.sh b/home-manager/config/lf/cmds/help.sh
index 8fedd0ea..5eb64dd5 100644
--- a/home-manager/config/lf/cmds/help.sh
+++ b/home-manager/config/lf/cmds/help.sh
@@ -1,8 +1,7 @@
-#!/bin/sh
+#!/usr/bin/env dash
# shellcheck disable=SC2086
# shellcheck source=/dev/null
-. ~/.local/lib/shell/lib
-
+. %SHELL_LIBRARY_PATH
cat ~/.config/lf/lfrc
diff --git a/home-manager/config/lf/cmds/mk_dir.sh b/home-manager/config/lf/cmds/mk_dir.sh
index bfa0627d..aaffce5f 100644
--- a/home-manager/config/lf/cmds/mk_dir.sh
+++ b/home-manager/config/lf/cmds/mk_dir.sh
@@ -1,7 +1,7 @@
-#!/bin/sh
+#!/usr/bin/env dash
# shellcheck disable=SC2086
# shellcheck source=/dev/null
-. ~/.local/lib/shell/lib
+. %SHELL_LIBRARY_PATH
readp "Directory Name: " ans
diff --git a/home-manager/config/lf/cmds/mk_file.sh b/home-manager/config/lf/cmds/mk_file.sh
index 044016a6..14fc8881 100644
--- a/home-manager/config/lf/cmds/mk_file.sh
+++ b/home-manager/config/lf/cmds/mk_file.sh
@@ -1,7 +1,7 @@
-#!/bin/sh
+#!/usr/bin/env dash
# shellcheck disable=SC2086
# shellcheck source=/dev/null
-. ~/.local/lib/shell/lib
+. %SHELL_LIBRARY_PATH
readp "File Name: " name
diff --git a/home-manager/config/lf/cmds/mk_ln.sh b/home-manager/config/lf/cmds/mk_ln.sh
index 71a70a36..f2129763 100644
--- a/home-manager/config/lf/cmds/mk_ln.sh
+++ b/home-manager/config/lf/cmds/mk_ln.sh
@@ -1,11 +1,11 @@
-#!/bin/sh
+#!/usr/bin/env dash
# shellcheck disable=SC2086
# shellcheck source=/dev/null
-. ~/.local/lib/shell/lib
+. %SHELL_LIBRARY_PATH
while IFS= read -r i;do
set -- "$@" "$i"
-done < "$(tmp "cat ~/.local/share/lf/files")"
+done < "$(tmp 'cat ~/.local/share/lf/files')"
mode="$1"
shift
@@ -19,7 +19,7 @@ fi
case "$mode" in
copy)
while [ "$#" -gt 0 ]; do
- file=$1
+ file="$1"
ans="$(basename "$file")"
while ls -a "$(pwd)" | grep --word-regexp "$ans" > /dev/null;do
diff --git a/home-manager/config/lf/cmds/mk_scr.sh b/home-manager/config/lf/cmds/mk_scr.sh
index 4b80e564..0441c63f 100644
--- a/home-manager/config/lf/cmds/mk_scr.sh
+++ b/home-manager/config/lf/cmds/mk_scr.sh
@@ -1,27 +1,27 @@
-#!/bin/sh
+#!/usr/bin/env dash
# shellcheck disable=SC2086
# shellcheck source=/dev/null
-. ~/.local/lib/shell/lib
+. %SHELL_LIBRARY_PATH
star=$(mktmp)
cat << EOF > $star
-#!/bin/sh
+#!/usr/bin/env dash
# shellcheck disable=SC2086
# shellcheck source=/dev/null
-. ~/.local/lib/shell/lib
+. %SHELL_LIBRARY_PATH
-LIB_TEMP_DIR_FOR_SCRIPT=$(mktemp -d)
+LIB_TEMP_DIR_FOR_SCRIPT=\$(mktemp -d)
-if [ -d "$LIB_TEMP_DIR_FOR_SCRIPT" ];then rm -r "$LIB_TEMP_DIR_FOR_SCRIPT"; fi
+if [ -d "\$LIB_TEMP_DIR_FOR_SCRIPT" ];then rm -r "\$LIB_TEMP_DIR_FOR_SCRIPT"; fi
EOF
readp "Script Name: " script_name
scr="$(pwd)"/"$script_name"
-[ -e $scr ] && die "$script_name exitst, exiting.."
+[ -e $scr ] && die "$script_name exist, exiting.."
cat "$star" > $scr
chmod +x $scr
diff --git a/home-manager/config/lf/cmds/open.sh b/home-manager/config/lf/cmds/open.sh
index 8376be21..bcfe62f4 100644
--- a/home-manager/config/lf/cmds/open.sh
+++ b/home-manager/config/lf/cmds/open.sh
@@ -1,7 +1,7 @@
-#!/bin/sh
+#!/usr/bin/env dash
# shellcheck disable=SC2086
# shellcheck source=/dev/null
-. ~/.local/lib/shell/lib
+. %SHELL_LIBRARY_PATH
case $(file --mime-type "$f" -bL) in
diff --git a/home-manager/config/lf/cmds/open_config.sh b/home-manager/config/lf/cmds/open_config.sh
index 93c174d7..4b103fe4 100644
--- a/home-manager/config/lf/cmds/open_config.sh
+++ b/home-manager/config/lf/cmds/open_config.sh
@@ -1,7 +1,7 @@
-#!/bin/sh
+#!/usr/bin/env dash
# shellcheck disable=SC2086
# shellcheck source=/dev/null
-. ~/.local/lib/shell/lib
+. %SHELL_LIBRARY_PATH
$EDITOR "$(bookmenu -b ~/.config/bookmenu/configs -f fzf -o)"
diff --git a/home-manager/config/lf/cmds/restore_trash.sh b/home-manager/config/lf/cmds/restore_trash.sh
index 432e9e9b..fd4641eb 100644
--- a/home-manager/config/lf/cmds/restore_trash.sh
+++ b/home-manager/config/lf/cmds/restore_trash.sh
@@ -1,10 +1,11 @@
-#!/bin/sh
+#!/usr/bin/env dash
# shellcheck disable=SC2086
# shellcheck source=/dev/null
-. ~/.local/lib/shell/lib
+. %SHELL_LIBRARY_PATH
-trash-restore
+trash list | fzf --multi | awk '{print $NF}' | xargs trash restore --match=exact
+
if [ -d /tmp/LIB_FILE_TEMP_DIR/ ];then rm -r /tmp/LIB_FILE_TEMP_DIR/; fi
diff --git a/home-manager/config/lf/cmds/set_wall_paper.sh b/home-manager/config/lf/cmds/set_wall_paper.sh
index 4599de2a..6ad9fc1f 100644
--- a/home-manager/config/lf/cmds/set_wall_paper.sh
+++ b/home-manager/config/lf/cmds/set_wall_paper.sh
@@ -1,7 +1,7 @@
-#!/bin/sh
+#!/usr/bin/env dash
# shellcheck disable=SC2086
# shellcheck source=/dev/null
-. ~/.local/lib/shell/lib
+. %SHELL_LIBRARY_PATH
die "No yet implemented"
diff --git a/home-manager/config/lf/cmds/stripspace.sh b/home-manager/config/lf/cmds/stripspace.sh
index c7f68767..0032be26 100644
--- a/home-manager/config/lf/cmds/stripspace.sh
+++ b/home-manager/config/lf/cmds/stripspace.sh
@@ -1,10 +1,11 @@
-#!/bin/sh
+#!/usr/bin/env dash
# shellcheck disable=SC2086
# shellcheck source=/dev/null
-. ~/.local/lib/shell/lib
+. %SHELL_LIBRARY_PATH
-stripspace "$f"
+die "This is still TODO"
+#stripspace "$f" # TODO
if [ -d /tmp/LIB_FILE_TEMP_DIR/ ];then rm -r /tmp/LIB_FILE_TEMP_DIR/; fi
diff --git a/home-manager/config/lf/cmds/sudo_mk_file.sh b/home-manager/config/lf/cmds/sudo_mk_file.sh
index 1f06a92f..c1443da0 100644
--- a/home-manager/config/lf/cmds/sudo_mk_file.sh
+++ b/home-manager/config/lf/cmds/sudo_mk_file.sh
@@ -1,7 +1,7 @@
-#!/bin/sh
+#!/usr/bin/env dash
# shellcheck disable=SC2086
# shellcheck source=/dev/null
-. ~/.local/lib/shell/lib
+. %SHELL_LIBRARY_PATH
readp "File Name: " ans
diff --git a/home-manager/config/lf/cmds/trash.sh b/home-manager/config/lf/cmds/trash.sh
index 4598b4fd..57351b78 100644
--- a/home-manager/config/lf/cmds/trash.sh
+++ b/home-manager/config/lf/cmds/trash.sh
@@ -1,26 +1,26 @@
-#!/bin/sh
+#!/usr/bin/env dash
# shellcheck disable=SC2086
# shellcheck source=/dev/null
-. ~/.local/lib/shell/lib
-
-files=$(printf "$fx" | tr '\n' ';')
-
-while [ "$files" ]; do
- # extract the substring from start of string up to delimiter.
- # this is the first "element" of the string.
- file=${files%%;*}
-
- trash-put "$(basename "$file")"
- # if there's only one element left, set `files` to an empty string.
- # this causes us to exit this `while` loop.
- # else, we delete the first "element" of the string from files, and move onto the next.
- if [ "$files" = "$file" ]; then
- files=''
- else
- files="${files#*;}"
- fi
-done
+. %SHELL_LIBRARY_PATH
+#files=$(printf "$fx" | tr '\n' ';')
+#
+#while [ "$files" ]; do
+# # extract the substring from start of string up to delimiter.
+# # this is the first "element" of the string.
+# file=${files%%;*}
+#
+# trash-put "$(basename "$file")"
+# # if there's only one element left, set `files` to an empty string.
+# # this causes us to exit this `while` loop.
+# # else, we delete the first "element" of the string from files, and move onto the next.
+# if [ "$files" = "$file" ]; then
+# files=''
+# else
+# files="${files#*;}"
+# fi
+#done
+thrash put "$fx";
diff --git a/home-manager/config/lf/cmds/unarchive.sh b/home-manager/config/lf/cmds/unarchive.sh
index 47a713fa..498ae424 100644
--- a/home-manager/config/lf/cmds/unarchive.sh
+++ b/home-manager/config/lf/cmds/unarchive.sh
@@ -1,7 +1,7 @@
-#!/bin/sh
+#!/usr/bin/env dash
# shellcheck disable=SC2086
# shellcheck source=/dev/null
-. ~/.local/lib/shell/lib
+. %SHELL_LIBRARY_PATH
# extract the current file with the right command
@@ -12,9 +12,12 @@ case "$f" in
*.tar.gz|*.tgz) tar xzvf $f;;
*.tar.xz|*.txz) tar xJvf $f;;
*.zip) unzip $f;;
- *.rar) unrar x $f;;
+ *.rar)
+ die "rar is a unfree format!"
+ #unrar x $f
+ ;;
*.7z) 7z x $f;;
- *) warning "Unsupported format" ;;
+ *) die "Unsupported format" ;;
esac