Skip to content

Commit

Permalink
adapted to current version (6.17.0)
Browse files Browse the repository at this point in the history
  • Loading branch information
bgol committed Apr 4, 2015
1 parent 108ab4f commit 61b3662
Showing 1 changed file with 108 additions and 21 deletions.
129 changes: 108 additions & 21 deletions scripts/td-completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# see http://kfs.org/td/source

common_opts="--help --debug --detail --quiet --db --cwd --link-ly"
pad_opts="? l l? m m? ml ml? s s? sl sm sm? sml sml?"
ynq_opts="y n ?"

_td_file_list()
{
Expand Down Expand Up @@ -56,12 +58,16 @@ _td_buy()
prev="${COMP_WORDS[COMP_CWORD-1]}"

case ${prev} in
--quantity|--near|--ly|--limit)
--quantity|--near|--ly|--limit|--gt|--lt)
# argument required
;;
--pad-size|-p)
opts="${pad_opts}"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
;;
*)
_td_common && return 0
opts="--quantity --near --ly --limit --price-sort --stock-sort ${common_opts}"
opts="--quantity --near --ly --limit --pad-size --one-stop --price-sort --stock-sort --gt --lt ${common_opts}"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
;;
esac
Expand Down Expand Up @@ -105,12 +111,12 @@ _td_import()
# argument required
;;
--option|-O)
opts="systems stations exportcsv skipdl force use3h use2d usefull"
opts="csvs corrections systems stations shipvendors exportcsv csvonly skipdl force use3h use2d usefull help"
COMPREPLY+=( $(compgen -W "${opts}" -- ${cur}) )
;;
*)
_td_common && return 0
opts="--plug --url --download --ignore-unknown --option ${common_opts}"
opts="--plug --url --download --ignore-unknown --option --reset ${common_opts}"
_td_file_list -f "$cur"
COMPREPLY+=( $(compgen -W "${opts}" -- ${cur}) )
;;
Expand All @@ -128,9 +134,29 @@ _td_local()
--ly)
# argument required
;;
--pad-size|-p)
opts="${pad_opts}"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
;;
*)
_td_common && return 0
opts="--ly --pad-size --stations --trading --blackmarket --shipyard --outfitting --rearm --refuel --repair ${common_opts}"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
;;
esac
return 0
}

_td_market()
{
local cur prev opts
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"

case ${prev} in
*)
_td_common && return 0
opts="--ly ${common_opts}"
opts="--buying --selling ${common_opts}"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
;;
esac
Expand All @@ -144,12 +170,12 @@ _td_nav()
prev="${COMP_WORDS[COMP_CWORD-1]}"

case ${prev} in
--ly-per|--avoid|--via)
--ly-per|--avoid|--via|--refuel-jumps)
# argument required
;;
*)
_td_common && return 0
opts="--ly-per --avoid --via --stations ${common_opts}"
opts="--ly-per --avoid --via --stations --refuel-jumps ${common_opts}"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
;;
esac
Expand All @@ -163,12 +189,12 @@ _td_olddata()
prev="${COMP_WORDS[COMP_CWORD-1]}"

case ${prev} in
--limit|--near|--ly)
--limit|--near|--ly|--min-age)
# argument required
;;
*)
_td_common && return 0
opts="--limit --near --ly ${common_opts}"
opts="--limit --near --ly --route --min-age ${common_opts}"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
;;
esac
Expand All @@ -182,12 +208,16 @@ _td_rares()
prev="${COMP_WORDS[COMP_CWORD-1]}"

case ${prev} in
--ly|--limit)
--ly|--limit|--away|--from)
# argument required
;;
--pad-size|-p)
opts="${pad_opts}"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
;;
*)
_td_common && return 0
opts="--ly --limit --price-sort --reverse ${common_opts}"
opts="--ly --limit --price-sort --reverse --pad-size --away --from ${common_opts}"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
;;
esac
Expand All @@ -201,12 +231,16 @@ _td_run()
prev="${COMP_WORDS[COMP_CWORD-1]}"

case ${prev} in
--capacity|--credits|--ly-per|--from|--to|--via|--avoid|--hops|--jumps-per|--empty-ly|--start-jumps|-s|--end-jumps|-e|--limit|--max-days-old|-MD|--ls-penalty|--lsp|--margin|--insurance|--routes)
--capacity|--credits|--ly-per|--from|-f|--to|-t|--via|--avoid|--hops|--jumps-per|--empty-ly|--start-jumps|-s|--end-jumps|-e|--limit|--age|--max-days-old|-MD|--ls-penalty|--lsp|--margin|--insurance|--routes|--towards|-T|--ls-max|--gain-per-ton|--gpt|--max-gain-per-ton|--mgpt|--max-routes|--prune-score|--prune-hops)
# argument required
;;
--pad-size|-p)
opts="${pad_opts}"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
;;
*)
_td_common && return 0
opts="--capacity --credits --ly-per --from --to --via --avoid --hops --jumps-per --empty-ly --start-jumps --end-jumps --limit --max-days-old --ls-penalty --unique --margin --insurance --routes --checklist --x52-pro ${common_opts}"
opts="--capacity --credits --ly-per --from --to --via --avoid --hops --jumps-per --empty-ly --start-jumps --end-jumps --limit --age --max-days-old --ls-penalty --unique --margin --insurance --routes --checklist --x52-pro --towards --loop --direct --pad-size --black-market --ls-max --gain-per-ton --gpt --max-gain-per-ton --mgpt --max-routes --prune-score --prune-hops --progress ${common_opts}"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
;;
esac
Expand All @@ -220,12 +254,32 @@ _td_sell()
prev="${COMP_WORDS[COMP_CWORD-1]}"

case ${prev} in
--near|--ly-per|--limit)
--near|--ly-per|--limit|--gt|--lt)
# argument required
;;
--pad-size|-p)
opts="${pad_opts}"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
;;
*)
_td_common && return 0
opts="--near --ly-per --limit --price-sort --pad-size --gt --lt ${common_opts}"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
;;
esac
return 0
}

_td_shipvendor()
{
local cur prev opts
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"

case ${prev} in
*)
_td_common && return 0
opts="--near --ly-per --limit --price-sort ${common_opts}"
opts="--remove --add --name-sort --no-export ${common_opts}"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
;;
esac
Expand All @@ -239,12 +293,36 @@ _td_station()
prev="${COMP_WORDS[COMP_CWORD-1]}"

case ${prev} in
--system|--ls-from-star|--black-market|--pad-size|--confirm)
--ls-from-star|--confirm)
# argument required
;;
--black-market|--bm|--market|--shipyard|--outfitting|--rearm|--arm|--refuel|--repair)
opts="${ynq_opts}"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
;;
--pad-size)
opts="${pad_opts}"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
;;
*)
_td_common && return 0
opts="--ls-from-star --black-market --market --shipyard --pad-size --outfitting --rearm --refuel --repair --confirm --add --remove --update --no-export ${common_opts}"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
;;
esac
return 0
}

_td_trade()
{
local cur prev opts
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"

case ${prev} in
*)
_td_common && return 0
opts="--system --ls-from-star --black-market --pad-size --confirm --add --remove --update --no-export ${common_opts}"
opts="${common_opts}"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
;;
esac
Expand Down Expand Up @@ -293,6 +371,9 @@ _td_main()
local)
_td_local
;;
market)
_td_market
;;
nav)
_td_nav
;;
Expand All @@ -308,14 +389,20 @@ _td_main()
sell)
_td_sell
;;
station)
_td_station
;;
shipvendor)
_td_shipvendor
;;
station)
_td_station
;;
trade)
_td_trade
;;
update)
_td_update
;;
*)
opts="buildcache buy export import local nav olddata rares run sell station update"
opts="buildcache buy export import local market nav olddata rares run sell shipvendor station trade update"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
esac
return 0
Expand Down

0 comments on commit 61b3662

Please sign in to comment.