hwinfo package to detect hw info.
[dotfiles] / .bash_compl
1 #!/bin/sh
2
3 # COMPREPLY: an array containing possible completions as a result of your function
4 # COMP_WORDS: an array containing individual command arguments typed so far
5 # COMP_CWORD: the index of the command argument containing the current cursor position
6 # COMP_LINE: the current command line
7
8 # if you want the current argument that you are trying to complete, you would index into the words array
9 # using: ${COMP_WORDS[COMP_CWORD]}.
10
11
12 # to complete jump
13 _completemarks() {
14 local curw=${COMP_WORDS[COMP_CWORD]}
15 local wordlist=$(find $MARKPATH -type l -printf "%f\n")
16 COMPREPLY=($(compgen -W '${wordlist[@]}' -- $curw))
17 return 0
18 } && complete -F _completemarks jump unmark
19
20 # to complete ssh-add with exisiting priv keys
21 _complete_ssh_add () {
22 local curw=${COMP_WORDS[COMP_CWORD]}
23 #local sshkeys=$(find $HOME/.ssh -type f -printf "%f\n" | grep 'id_' | grep -v '.pub$');
24 local sshkeys=$(find $HOME/.ssh -type f | grep --color 'id_' | grep $HOME'/.ssh/id_' | grep -v '.pub$');
25 COMPREPLY=($(compgen -W '${sshkeys[@]}' -- $curw))
26 return 0
27 } && complete -F _complete_ssh_add ssh-add