dotfiles/fish/.config/fish/functions/dotg.fish

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