Adds metadata + support for multiple arguments

pull/1516/head
David Farrell 2020-03-10 22:58:39 -07:00
parent 6419d9246d
commit 8e9dadfaad
No known key found for this signature in database
GPG Key ID: 1CCA28D0E300B56F
1 changed files with 12 additions and 1 deletions

View File

@ -4,6 +4,17 @@ about-plugin 'Simplify `curl cht.sh/<query>` to `cht.sh <query>`'
# Play nicely if user already installed cht.sh cli tool # Play nicely if user already installed cht.sh cli tool
if ! _command_exists cht.sh ; then if ! _command_exists cht.sh ; then
function cht.sh () { function cht.sh () {
curl "cht.sh/$1" about 'Executes a cht.sh curl query using the provided arguments'
param ' [ ( topic [sub-topic] ) | ~keyword ] [ :list | :help | :learn ]'
example '$ cht.sh :help'
example '$ cht.sh :list'
example '$ cht.sh tar'
example '$ cht.sh js "parse json"'
example '$ cht.sh python :learn'
example '$ cht.sh rust :list'
group 'cht-sh'
local query=$(IFS=/ ; echo "$*")
curl "cht.sh/${query}"
} }
fi fi