diff options
-rwxr-xr-x | home-manager/config/lf/cmds/archive | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/home-manager/config/lf/cmds/archive b/home-manager/config/lf/cmds/archive index 4ea86787..fd032dd4 100755 --- a/home-manager/config/lf/cmds/archive +++ b/home-manager/config/lf/cmds/archive @@ -12,22 +12,28 @@ set -f archivers=$(tmp 'echo "gzip xz 7z zip"'); -readp "File Name: " name +readp "File Name: " name; +FX="$(awk -v Root="$(if [ "$(pwd)" = "/" ]; then pwd; else echo "$(pwd)/";fi)" '{ +for (i=1; i<=NF; i++) { + gsub(Root, "", $i); + print $i; +} +}' "$(tmp "echo \"$fx\" | tr '\n' ' '")")"; case $(awk '{for (i=1; i<=NF; i++) print $i}' $archivers | fzf) in "gzip") - tar -czf "$name".tar.gz "$fx" + tar -czf "$name".tar.gz $FX ;; "xz") - tar -cf "$name".tar "$fx" + tar -cf "$name".tar $FX xz -z -9 -e -T0 "$name".tar ;; "7z") - 7z a "$name".7z "$fx" + 7z a "$name".7z $FX ;; "zip") - zip -r "$name".zip "$fx" + zip --symlinks -r "$name".zip $FX ;; esac # vim: ft=sh |