diff --git a/home/joshuto.nix b/home/joshuto.nix index 89c8240..7782ddf 100644 --- a/home/joshuto.nix +++ b/home/joshuto.nix @@ -481,64 +481,65 @@ realpath=$(realpath "$FILE_PATH") handle_extension() { - case "''${FILE_EXTENSION_LOWER}" in - ts | js | lock) - bat --color=always --paging=never \ - --style=plain \ - --terminal-width="''${PREVIEW_WIDTH}" \ - "''${FILE_PATH}" && exit 0 - cat "''${FILE_PATH}" && exit 0 - exit 1;; + case "''${FILE_EXTENSION_LOWER}" in + ts | js | lock) + bat --color=always --paging=never \ + --style=plain \ + --terminal-width="''${PREVIEW_WIDTH}" \ + "''${FILE_PATH}" && exit 0 + cat "''${FILE_PATH}" && exit 0 + exit 1;; - rar) - lsar "''${FILE_PATH}" && exit 0 - exit 1;; - 7z) - 7z l -p -- "''${FILE_PATH}" && exit 0 - exit 1;; + rar) + lsar "''${FILE_PATH}" && exit 0 + exit 1;; - pdf) - pdftotext -l 10 -nopgbrk -q -- "''${FILE_PATH}" - | \ - fmt -w "''${PREVIEW_WIDTH}" && exit 0 - mutool draw -F txt -i -- "''${FILE_PATH}" 1-10 | \ - fmt -w "''${PREVIEW_WIDTH}" && exit 0 - exiftool "''${FILE_PATH}" && exit 0 - exit 1;; + 7z) + 7z l -p -- "''${FILE_PATH}" && exit 0 + exit 1;; - torrent) - transmission-show -- "''${FILE_PATH}" && exit 0 - exit 1;; + pdf) + pdftotext -l 10 -nopgbrk -q -- "''${FILE_PATH}" - | \ + fmt -w "''${PREVIEW_WIDTH}" && exit 0 + mutool draw -F txt -i -- "''${FILE_PATH}" 1-10 | \ + fmt -w "''${PREVIEW_WIDTH}" && exit 0 + exiftool "''${FILE_PATH}" && exit 0 + exit 1;; - json) - jq --color-output . "''${FILE_PATH}" && exit 0 - ;; - esac + torrent) + transmission-show -- "''${FILE_PATH}" && exit 0 + exit 1;; + + json) + jq --color-output . "''${FILE_PATH}" && exit 0 + ;; + esac } handle_mime() { local mimetype="''${1}" case "''${mimetype}" in - ## Text - text/* | */xml) - bat --color=always --paging=never \ - --style=plain \ - --terminal-width="''${PREVIEW_WIDTH}" \ - "''${FILE_PATH}" && exit 0 - cat "''${FILE_PATH}" && exit 0 - exit 1;; + ## Text + text/* | */xml) + bat --color=always --paging=never \ + --style=plain \ + --terminal-width="''${PREVIEW_WIDTH}" \ + "''${FILE_PATH}" && exit 0 + cat "''${FILE_PATH}" && exit 0 + exit 1;; - ## Image - image/*) - exit 5;; + ## Image + image/*) + exit 5;; - ## Video and audio - video/* | audio/*) - echo "$realpath" - mediainfo "''${FILE_PATH}" && exit 0 - exiftool "''${FILE_PATH}" && exit 0 - exit 1;; - esac + ## Video and audio + video/* | audio/*) + echo "$realpath" + mediainfo "''${FILE_PATH}" && exit 0 + exiftool "''${FILE_PATH}" && exit 0 + exit 1;; + esac } FILE_EXTENSION="''${FILE_PATH##*.}"