bash-completion.sh
branchv_0
changeset 28 9172bd97ae99
parent 27 532953173cd5
child 29 6f15f18d2abf
equal deleted inserted replaced
27:532953173cd5 28:9172bd97ae99
    10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    11 # GNU General Public License for more details.
    11 # GNU General Public License for more details.
    12 #
    12 #
    13 # You should have received a copy of the GNU General Public License
    13 # You should have received a copy of the GNU General Public License
    14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
    14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
       
    15 
       
    16 _relpipe_in_filesystem_scripts() {
       
    17 	while read c; do echo ${c:31}; done < <(compgen -c "__relpipe_in_filesystem_script_");
       
    18 }
    15 
    19 
    16 _relpipe_in_filesystem_completion() {
    20 _relpipe_in_filesystem_completion() {
    17 	local w0 w1 w2
    21 	local w0 w1 w2
    18 
    22 
    19 	COMPREPLY=()
    23 	COMPREPLY=()
    63 	elif [[ "$w1" == "--option"        && "x$w0" == "x" ]];    then COMPREPLY=("''")
    67 	elif [[ "$w1" == "--option"        && "x$w0" == "x" ]];    then COMPREPLY=("''")
    64 	elif [[ "$w2" == "--option"        && "x$w0" == "x" ]];    then COMPREPLY=("''")
    68 	elif [[ "$w2" == "--option"        && "x$w0" == "x" ]];    then COMPREPLY=("''")
    65 	elif [[ "$w1" == "--file"                           ]];    then COMPREPLY=($(compgen -W "${FILE_FIELDS[*]}"  -- "$w0"))
    69 	elif [[ "$w1" == "--file"                           ]];    then COMPREPLY=($(compgen -W "${FILE_FIELDS[*]}"  -- "$w0"))
    66 	elif [[ "$w1" == "--xattr"                          ]];    then COMPREPLY=($(compgen -W "${XATTR_FIELDS[*]}" -- "$w0"))
    70 	elif [[ "$w1" == "--xattr"                          ]];    then COMPREPLY=($(compgen -W "${XATTR_FIELDS[*]}" -- "$w0"))
    67 	elif [[ "$w1" == "--hash"                           ]];    then COMPREPLY=($(compgen -W "${HASH_FIELDS[*]}" -- "$w0"))
    71 	elif [[ "$w1" == "--hash"                           ]];    then COMPREPLY=($(compgen -W "${HASH_FIELDS[*]}" -- "$w0"))
       
    72 	elif [[ "$w1" == "--script"                         ]];    then COMPREPLY=($(compgen -W "$(_relpipe_in_filesystem_scripts)" -- "$w0"))
    68 	else
    73 	else
    69 		OPTIONS=(
    74 		OPTIONS=(
    70 			"--relation"
    75 			"--relation"
    71 			"--file"
    76 			"--file"
    72 			"--xattr"
    77 			"--xattr"
    73 			"--hash"
    78 			"--hash"
       
    79 			"--script"
    74 			"--as"
    80 			"--as"
    75 			"--option"
    81 			"--option"
    76 		)
    82 		)
    77 		COMPREPLY=($(compgen -W "${OPTIONS[*]}" -- "$w0"))
    83 		COMPREPLY=($(compgen -W "${OPTIONS[*]}" -- "$w0"))
    78 	fi
    84 	fi