diff --git a/.config/helix/scripts/typst-zathura.fish b/.config/helix/scripts/typst-zathura.fish index d57881e4..231e65f5 100755 --- a/.config/helix/scripts/typst-zathura.fish +++ b/.config/helix/scripts/typst-zathura.fish @@ -17,10 +17,26 @@ function find_pdf end end +if set -q _flag_q + set ret 1 +else + set ret 0 +end + +function qecho + if not set -q _flag_q + echo $argv[1] + end +end + set -l src (path resolve $argv[1]) # echo $src # string replace -set -l targ (string replace --filter '.typ' '.pdf' $src) +if not string match -q '.typ' $src + qecho "$(path basename $src) is not a Typst file!" + return $ret +end +set -l targ (string replace '.typ' '.pdf' $src) set -l base (path basename --no-extension $src).pdf if test -f "$targ" -a '' != '' # zathura "$targ" &>/dev/null &