Guest User

Untitled

a guest
Jun 23rd, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. __cltwitter_complete () {
  2. local cache="$HOME/.cltwitter_users.cache"
  3. local string=${COMP_WORDS[COMP_CWORD]}
  4. local last_word=${string##* }
  5. local prefix=${string% *}
  6.  
  7. COMPREPLY=()
  8.  
  9. #if [ ! -f ${cache} ] || [ "`find ${cache} -mmin +60`" != "" ]; then
  10. # cltwitter-update-cache
  11. #fi
  12.  
  13. if [[ "$last_word" == "@* ]]; then # if word is beginning of a quotation
  14. last_word=${last_word:2}
  15. elif [[ "$last_word" == @* ]]; then # if user put '@' in front
  16. last_word=${last_word:1}
  17. fi
  18.  
  19. COMPREPLY=( $( compgen -W "`cat $cache`" -P @ -- $last_word ) )
  20. }
  21.  
  22. complete -F __cltwitter_complete tweet
  23.  
  24. tweet Foo bar @s<TAB>
Add Comment
Please, Sign In to add comment