fish: functions: Check return result of fzf selection
This commit is contained in:
parent
3279c97814
commit
7310c77f78
10 changed files with 30 additions and 10 deletions
|
@ -1,4 +1,6 @@
|
|||
function cdG --description 'Select a coredump to run coredumpctl gdb'
|
||||
coredumpctl list --reverse | awk -F" " '$9 == "present"' | fzf | read -l result
|
||||
coredumpctl gdb (echo $result | awk -F" " '{print $5}')
|
||||
if test -n "$result"
|
||||
coredumpctl gdb (echo $result | awk -F" " '{print $5}')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
function cdi --description 'Select a coredump to run coredumpctl info'
|
||||
coredumpctl list --reverse | awk -F" " '$9 == "present"' | fzf | read -l result
|
||||
coredumpctl info (echo $result | awk -F" " '{print $5}')
|
||||
if test -n "$result"
|
||||
coredumpctl info (echo $result | awk -F" " '{print $5}')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
function pfr --description 'Select a process to record performance data in given file name'
|
||||
set proc (ps -ef | fzf | awk '{print $2}')
|
||||
perf record -F 99 -o $argv -p $proc
|
||||
if test -n "$proc"
|
||||
perf record -F 99 -o $argv -p $proc
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
function pft --description 'Select a process to run perf top'
|
||||
set proc (ps -ef | fzf | awk '{print $2}')
|
||||
perf top -p $proc
|
||||
if test -n "$proc"
|
||||
perf top -p $proc
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
function pk --description 'Fuzzy find a process to kill'
|
||||
set proc (ps -ef | fzf | awk '{print $2}')
|
||||
kill -SIGKILL $proc
|
||||
if test -n "$proc"
|
||||
kill -SIGKILL $proc
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
function psmem --description 'Show memory usage of a process'
|
||||
set proc (ps -ef | fzf | awk '{print $2}')
|
||||
ps_mem -p $proc
|
||||
if test -n "$proc"
|
||||
ps_mem -p $proc
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
function pst --description 'Show process tree of a process'
|
||||
set proc (ps -ef | fzf | awk '{print $2}' | head -1)
|
||||
pstree -H $proc $proc
|
||||
if test -n "$proc"
|
||||
pstree -H $proc $proc
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
function rfc --description 'Search for string in RFC documents and open'
|
||||
if test -e ~/rfc
|
||||
rg --files-with-matches $argv ~/rfc | fzf --preview='less {}' | read -l result
|
||||
nvim -R $result
|
||||
if test -n "$result"
|
||||
nvim -R $result
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
function ta --description 'Attaches to a selected session'
|
||||
set session (tmux list-sessions | fzf | awk -F':' '{print $1}')
|
||||
tmux attach -t $session
|
||||
if test -n "$session"
|
||||
tmux attach -t $session
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
function topf --description 'Select a process to run top'
|
||||
set proc (ps -ef | fzf | awk '{print $2}')
|
||||
top -H -p $proc
|
||||
if test -n "$proc"
|
||||
top -H -p $proc
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue