fish: functions/dotg: Sort the results on basis of time

Idea adapted from
https://stackoverflow.com/questions/45500978/vim-fzf-sort-initial-results-on-file-date
This commit is contained in:
Sanchayan Maity 2023-01-16 12:30:45 +05:30
parent 5ac754ea99
commit 5ed30a7796
Signed by: sanchayanmaity
GPG key ID: 6F6A0609C12038F3

View file

@ -5,7 +5,7 @@ function dotg --description 'Generate gstreamer dot graph for selected file'
set dotpath "$GST_DEBUG_DUMP_DOT_DIR" set dotpath "$GST_DEBUG_DUMP_DOT_DIR"
end end
find $dotpath -maxdepth 1 -regextype posix-extended -regex ".*\.(dot)" | fzf | read -l result find /tmp/gst-dot -maxdepth 1 -regextype posix-extended -regex ".*\.(dot)" -printf '%T@ %p\n' | sort -k 1 -n -r | fzf | awk -F' ' '{print $2}' | read -l result
if test -n "$result" if test -n "$result"
dot -Tsvg "$result" -O dot -Tsvg "$result" -O