2015-10-12 03:09:25 +08:00
|
|
|
#
|
|
|
|
# Completions for tr
|
|
|
|
#
|
2012-06-16 08:30:10 +08:00
|
|
|
|
2015-10-12 03:09:25 +08:00
|
|
|
# Test if we are using GNU tr
|
2018-04-02 04:42:38 +08:00
|
|
|
if command tr --version >/dev/null 2>/dev/null
|
2019-05-05 18:53:09 +08:00
|
|
|
complete -c tr -x
|
|
|
|
complete -c tr -s c -s C -l complement -d 'use the complement of SET1'
|
|
|
|
complete -c tr -s d -l delete -d 'delete characters in SET1, do not translate'
|
2023-02-15 04:16:22 +08:00
|
|
|
complete -c tr -s s -l squeeze-repeats -d 'replace each run of a character listed in SET1 with a single occurrence of that character'
|
2019-05-05 18:53:09 +08:00
|
|
|
complete -c tr -s t -l truncate-set1 -d 'first truncate SET1 to length of SET2'
|
|
|
|
complete -c tr -l help -d 'display this help and exit'
|
|
|
|
complete -c tr -l version -d 'output version information and exit'
|
2015-10-12 03:09:25 +08:00
|
|
|
|
2019-05-05 18:53:09 +08:00
|
|
|
complete -c tr -a '[:alnum:]' -d 'all letters and digits'
|
|
|
|
complete -c tr -a '[:alpha:]' -d 'all letters'
|
|
|
|
complete -c tr -a '[:blank:]' -d 'all horizontal whitespace'
|
|
|
|
complete -c tr -a '[:cntrl:]' -d 'all control characters'
|
|
|
|
complete -c tr -a '[:digit:]' -d 'all digits'
|
|
|
|
complete -c tr -a '[:graph:]' -d 'all printable characters, not including space'
|
|
|
|
complete -c tr -a '[:lower:]' -d 'all lower case letters'
|
|
|
|
complete -c tr -a '[:print:]' -d 'all printable characters, including space'
|
|
|
|
complete -c tr -a '[:punct:]' -d 'all punctuation characters'
|
|
|
|
complete -c tr -a '[:space:]' -d 'all horizontal or vertical whitespace'
|
|
|
|
complete -c tr -a '[:upper:]' -d 'all upper case letters'
|
|
|
|
complete -c tr -a '[:xdigit:]' -d 'all hexadecimal digits'
|
2015-10-12 03:09:25 +08:00
|
|
|
else
|
2019-05-05 18:53:09 +08:00
|
|
|
# If not a GNU system, assume we have standard BSD tr features instead
|
|
|
|
complete -c tr -x
|
2023-02-15 04:16:22 +08:00
|
|
|
complete -c tr -s C -d 'Complement the set of characters in string1'
|
|
|
|
complete -c tr -s c -d 'Same as -C but complement the set of values in string1'
|
|
|
|
complete -c tr -s d -d 'Delete characters in string1 from the input'
|
|
|
|
complete -c tr -s s -d 'Squeeze runs of characters listed in the last operand into one'
|
2019-05-05 18:53:09 +08:00
|
|
|
complete -c tr -l u -d 'Guarantee that any output is unbuffered.'
|
2015-10-12 03:09:25 +08:00
|
|
|
|
2019-05-05 18:53:09 +08:00
|
|
|
complete -c tr -a '[:alnum:]' -d 'alphanumeric characters'
|
|
|
|
complete -c tr -a '[:alpha:]' -d 'alphabetic characters'
|
|
|
|
complete -c tr -a '[:blank:]' -d 'whitespace characters'
|
|
|
|
complete -c tr -a '[:cntrl:]' -d 'control characters'
|
|
|
|
complete -c tr -a '[:digit:]' -d 'numeric characters'
|
|
|
|
complete -c tr -a '[:graph:]' -d 'graphic characters'
|
|
|
|
complete -c tr -a '[:ideogram:]' -d 'ideographic characters'
|
|
|
|
complete -c tr -a '[:lower:]' -d 'lower-case alphabetic characters'
|
|
|
|
complete -c tr -a '[:phonogram:]' -d 'phonographic characters'
|
|
|
|
complete -c tr -a '[:print:]' -d 'printable characters'
|
|
|
|
complete -c tr -a '[:punct:]' -d 'punctuation characters'
|
|
|
|
complete -c tr -a '[:rune:]' -d 'valid characters'
|
|
|
|
complete -c tr -a '[:space:]' -d 'space characters'
|
|
|
|
complete -c tr -a '[:special:]' -d 'special characters'
|
|
|
|
complete -c tr -a '[:upper:]' -d 'upper-case characters'
|
|
|
|
complete -c tr -a '[:xdigit:]' -d 'hexadecimal characters'
|
2015-10-12 03:09:25 +08:00
|
|
|
end
|