completions/ssh: history --max=n might be better than head -n

This commit is contained in:
Johannes Altmanninger 2020-10-10 08:21:48 +02:00
parent 1173e8bda4
commit f917211f3b

View file

@ -59,7 +59,7 @@ function __ssh_history_completions --argument-names limit
set limit 100 set limit 100
end end
history --prefix ssh | string replace -rf '.* ([A-Za-z0-9._:-]+@[A-Za-z0-9._:-]+).*' '$1' | head -n $limit history --prefix ssh --max=$limit | string replace -rf '.* ([A-Za-z0-9._:-]+@[A-Za-z0-9._:-]+).*' '$1'
end end
complete -k -c ssh -a '(__ssh_history_completions 100)' -f -d Remote complete -k -c ssh -a '(__ssh_history_completions 100)' -f -d Remote