Created
August 19, 2016 07:59
-
-
Save rubenvereecken/53d4c9173bf80245dff1155f902077a7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#compdef tldr | |
local -a pages oses | |
pages=$(tldr -a1) | |
oses='( linux osx sunos )' | |
# What are all those options foooor | |
_arguments \ | |
'(- *)'{-h,--help}'[show help]' \ | |
'(- *)'{-v,--version}'[show version number]' \ | |
'(- *)'{-l,--list}'[list all commands for chosen platform]' \ | |
'(- *)'{-a,--list-all}'[list all commands]' \ | |
'(- *)'{-1,--single-column}'[list one command per line (used with -l or -a)]' \ | |
'(- *)'{-r,--random}'[show a random command]' \ | |
'(- *)'{-e,--random-example}'[show a random example]' \ | |
'(-f --render)'{-f,--render}'[render a specific markdown file]:markdown file:_files -/' \ | |
'(-o --os)'{-o,--os}"[override operating system]:os:${oses}" \ | |
'--linux[override operating system with Linux]' \ | |
'--osx[override operating system with OSX]' \ | |
'--sunos[override operating system with SunOS]' \ | |
'(- *)'{-u,--update}'[update local cache]' \ | |
'(- *)'{-c,--clear-cache}'[clear local cache]' \ | |
"*:page:(${pages})" && return 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment