Skip to content

Instantly share code, notes, and snippets.

@hirose31
Forked from ywatase/jsx
Created June 12, 2012 08:53
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hirose31/2916295 to your computer and use it in GitHub Desktop.
Save hirose31/2916295 to your computer and use it in GitHub Desktop.
_jsx()
{
local cur prev
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
JSX_OPTIONS='\
--add-search-path\
--executable\
--run\
--test\
--output\
--mode\
--target\
--release\
--optimize\
--enable-type-check\
--enable-source-map\
--version\
--help'
case $prev in
--add-search-path)
COMPREPLY=($( compgen -d -- $cur ))
;;
--output)
COMPREPLY=($( compgen -W "FILE" -- $cur ))
;;
--mode)
COMPREPLY=($( compgen -W "compile parse" -- $cur ))
;;
--target)
COMPREPLY=($( compgen -W "javascript c++" -- $cur ))
;;
--optimize)
COMPREPLY=($( compgen -W "no-assert no-log inline return-if" -- $cur ))
;;
*)
COMPREPLY=($( compgen -W "$JSX_OPTIONS" -- $cur ))
;;
esac
return 0
}
complete -F _jsx $filenames jsx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment