bash-completion.sh
branchv_0
changeset 27 532953173cd5
parent 25 3f47b43e528d
child 28 9172bd97ae99
equal deleted inserted replaced
26:1b14ef641c7b 27:532953173cd5
    48 		"dublincore.title"
    48 		"dublincore.title"
    49 		"dublincore.creator"
    49 		"dublincore.creator"
    50 		"dublincore.rights"
    50 		"dublincore.rights"
    51 	)
    51 	)
    52 
    52 
       
    53 	HASH_FIELDS=(
       
    54 		"md5"
       
    55 		"sha1"
       
    56 		"sha256"
       
    57 		"sha512"
       
    58 	)
       
    59 
    53 
    60 
    54 	if   [[ "$w1" == "--relation"      && "x$w0" == "x" ]];    then COMPREPLY=("''")
    61 	if   [[ "$w1" == "--relation"      && "x$w0" == "x" ]];    then COMPREPLY=("''")
    55 	elif [[ "$w1" == "--as"            && "x$w0" == "x" ]];    then COMPREPLY=("''")
    62 	elif [[ "$w1" == "--as"            && "x$w0" == "x" ]];    then COMPREPLY=("''")
    56 	elif [[ "$w1" == "--option"        && "x$w0" == "x" ]];    then COMPREPLY=("''")
    63 	elif [[ "$w1" == "--option"        && "x$w0" == "x" ]];    then COMPREPLY=("''")
    57 	elif [[ "$w2" == "--option"        && "x$w0" == "x" ]];    then COMPREPLY=("''")
    64 	elif [[ "$w2" == "--option"        && "x$w0" == "x" ]];    then COMPREPLY=("''")
    58 	elif [[ "$w1" == "--file"                           ]];    then COMPREPLY=($(compgen -W "${FILE_FIELDS[*]}"  -- "$w0"))
    65 	elif [[ "$w1" == "--file"                           ]];    then COMPREPLY=($(compgen -W "${FILE_FIELDS[*]}"  -- "$w0"))
    59 	elif [[ "$w1" == "--xattr"                          ]];    then COMPREPLY=($(compgen -W "${XATTR_FIELDS[*]}" -- "$w0"))
    66 	elif [[ "$w1" == "--xattr"                          ]];    then COMPREPLY=($(compgen -W "${XATTR_FIELDS[*]}" -- "$w0"))
       
    67 	elif [[ "$w1" == "--hash"                           ]];    then COMPREPLY=($(compgen -W "${HASH_FIELDS[*]}" -- "$w0"))
    60 	else
    68 	else
    61 		OPTIONS=(
    69 		OPTIONS=(
    62 			"--relation"
    70 			"--relation"
    63 			"--file"
    71 			"--file"
    64 			"--xattr"
    72 			"--xattr"
       
    73 			"--hash"
    65 			"--as"
    74 			"--as"
    66 			"--option"
    75 			"--option"
    67 		)
    76 		)
    68 		COMPREPLY=($(compgen -W "${OPTIONS[*]}" -- "$w0"))
    77 		COMPREPLY=($(compgen -W "${OPTIONS[*]}" -- "$w0"))
    69 	fi
    78 	fi