From e6c64c61aef372a37bff5b0b2c6774fddd98c16f Mon Sep 17 00:00:00 2001 From: Sanchayan Maity Date: Fri, 3 Mar 2023 11:28:28 +0530 Subject: [PATCH] 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. --- fish/.config/fish/functions/dotg.fish | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fish/.config/fish/functions/dotg.fish b/fish/.config/fish/functions/dotg.fish index 858204d..aaa88ad 100644 --- a/fish/.config/fish/functions/dotg.fish +++ b/fish/.config/fish/functions/dotg.fish @@ -5,10 +5,11 @@ function dotg --description 'Generate gstreamer dot graph for selected file' set dotpath "$GST_DEBUG_DUMP_DOT_DIR" end - find /tmp/gst-dot -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 + 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" - dot -Tsvg "$result" -O - mv "$result".svg ~/Pictures/gstreamer + set filename (echo $result | sed 's/\.[^.]*$//') + dot -Tsvg "$result" -o "$filename".svg + mv "$filename".svg ~/Pictures/gstreamer end end