Skip to content

Instantly share code, notes, and snippets.

@hiratake26to
Created February 19, 2020 10:30
Show Gist options
  • Save hiratake26to/fa1861f4f398b85e02a22a57ad996676 to your computer and use it in GitHub Desktop.
Save hiratake26to/fa1861f4f398b85e02a22a57ad996676 to your computer and use it in GitHub Desktop.
#!/usr/local/env bash
_tgimpack()
{
local cmd_list="build clean config help init interact new pack run version"
local cur prev cword
_get_comp_words_by_ref -n : cur prev cword
case "${cword}" in
1)
COMPREPLY=( $(compgen -W "${cmd_list}" -- ${cur}) );;
*)
case "${prev}" in
"build")
;;
"clean")
;;
"config")
COMPREPLY=( $(compgen -W "entry output loader target project target-dir" -- ${cur}) );;
"help")
COMPREPLY=( $(compgen -W "${cmd_list}" -- ${cur}) );;
"init")
if [[ "${cur}" =~ ^-(.*)$ ]]; then
COMPREPLY=( $(compgen -W "-i --no-i" -- ${cur}) )
fi;;
"interact")
;;
"new")
if [[ "${cur}" =~ ^-(.*)$ ]]; then
COMPREPLY=( $(compgen -W "--ns3dir" -- ${cur}) )
fi;;
"pack")
COMPREPLY=( $(compgen -W "$(ls)" -- ${cur}) );;
"run")
if [[ "${cur}" =~ ^-(.*)$ ]]; then
COMPREPLY=( $(compgen -W "--nobuild --no-nobuild" -- ${cur}) )
fi;;
"version")
;;
esac;;
esac
}
complete -F _tgimpack tgim-pack
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment