File: bash_completion

package info (click to toggle)
golang-github-colinmarc-hdfs 2.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 3,760 kB
  • sloc: sh: 130; xml: 40; makefile: 31
file content (26 lines) | stat: -rw-r--r-- 570 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash

_hdfs_complete()
{
    local cur prev opts
    COMPREPLY=()
    cur="${COMP_WORDS[COMP_CWORD]}"
    words=$(IFS=$' '; echo "${COMP_WORDS[@]:0:COMP_CWORD+1}")
    opts=$(${COMP_WORDS[0]} complete "$words")

    if [[ $opts == "_FILE_" ]]
    then
      COMPREPLY=( $(compgen -o default -- ${cur}) )
    else
      COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
    fi

    if [[ $COMPREPLY != "" && $COMPREPLY != */ && $COMP_POINT == ${#COMP_LINE} ]]
    then
      COMPREPLY="$COMPREPLY "
    fi

    return 0
}

complete -o nospace -F _hdfs_complete hdfs