dotfiles/fish/.config/fish/functions/dotg.fish
Sanchayan Maity e6c64c61ae
fish: functions/dotg: Do not add dot to output file name
If a file name was foo.dot the current implementation generated a
foo.dot.svg. Fix it to just output a foo.svg.

Also fix a bug, where we were not considering the provided dotpath.
2023-03-03 15:57:29 +05:30

16 lines
600 B
Fish

function dotg --description 'Generate gstreamer dot graph for selected file'
if count $argv >/dev/null
set dotpath "$argv"
else
set dotpath "$GST_DEBUG_DUMP_DOT_DIR"
end
find $dotpath -maxdepth 1 -regextype posix-extended -regex ".*\.(dot)" -printf '%T@ %p\n' | sort -k 1 -n -r | fzf --bind "ctrl-d:half-page-down,ctrl-u:half-page-up" | awk -F' ' '{print $2}' | read -l result
if test -n "$result"
set filename (echo $result | sed 's/\.[^.]*$//')
dot -Tsvg "$result" -o "$filename".svg
mv "$filename".svg ~/Pictures/gstreamer
end
end