My build of nnn with minor changes
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

46 lines
781 B

  1. #
  2. # Rudimentary Bash completion definition for nnn.
  3. #
  4. # Author:
  5. # Arun Prakash Jana <engineerarun@gmail.com>
  6. #
  7. _nnn () {
  8. COMPREPLY=()
  9. local IFS=$' \n'
  10. local cur=$2 prev=$3
  11. local -a opts opts_with_args
  12. opts=(
  13. -b
  14. -d
  15. -e
  16. -h
  17. -i
  18. -l
  19. -n
  20. -p
  21. -s
  22. -S
  23. -v
  24. -w
  25. )
  26. opts_with_arg=(
  27. -b
  28. -p
  29. )
  30. # Do not complete non option names
  31. [[ $cur == -* ]] || return 1
  32. # Do not complete when the previous arg is an option expecting an argument
  33. for opt in "${opts_with_arg[@]}"; do
  34. [[ $opt == $prev ]] && return 1
  35. done
  36. # Complete option names
  37. COMPREPLY=( $(compgen -W "${opts[*]}" -- "$cur") )
  38. return 0
  39. }
  40. complete -F _nnn nnn