Browse Source

Update to bash_completion, snuffler now completes

ims_to_stationxml
miili 5 years ago
parent
commit
61b1b88e05
  1. 77
      extras/pyrocko
  2. 2
      setup.py

77
extras/pyrocko

@ -0,0 +1,77 @@
# bash-completion
# For fomosto, the grinding mill!
_opt_filenames()
{
echo $(compgen -o filenames -A file $cur)
}
_opt_dirnames()
{
echo $(compgen -o dirnames $cur)
}
_fomosto_options()
{
local cur opts
COMPREPLY=()
opts=""
cur=${COMP_WORDS[COMP_CWORD]}
_avail_types="qseis.2006a qseis.2006 qssp.2010 qssp.2010beta ahfullgreen"
_std="--help -h --loglevel"
declare -A arg_subsub
arg_subsub["build"]="--force --nworkers --continue --step --block $_std"
arg_subsub["stats"]="$_std"
arg_subsub["check"]="$_std"
arg_subsub["decimate"]=""
arg_subsub["redeploy"]=""
arg_subsub["view"]="--show-phases --extract $_std"
arg_subsub["extract"]="--format --output $_std"
arg_subsub["import"]=""
arg_subsub["export"]=""
arg_subsub["ttt"]="--force"
arg_subsub["tttview"]="--source-depth $_std"
arg_subsub["tttextract"]="--output $_std"
arg_subsub["server"]="--port --ip $_std"
arg_subsub["download"]="--force $_std"
arg_subsub["modelview"]="--paramerters $_std"
arg_subsub["upgrade"]="$_std"
arg_subsub["addref"]="$_std"
arg_subsub["qc"]="$_std"
if [ $COMP_CWORD = 1 ]; then
opts="upgrade stats qc modelview decimate redeploy ttt download init addref export build tttextract tttview import server extract check view"
elif [ $COMP_CWORD = 2 ]; then
if [ ${COMP_WORDS[1]} = "init" ]; then
opts="$_avail_types"
else
opts="$(_opt_dirnames)"
fi
elif [ $COMP_CWORD = 3 ]; then
opts=${arg_subsub[${COMP_WORDS[1]}]}
fi
COMPREPLY=( $(compgen -W '${opts}' $cur) )
return 0
}
_snuffler_options()
{
local cur opts
COMPREPLY=()
opts=""
cur=${COMP_WORDS[COMP_CWORD]}
if [ $COMP_CWORD = 1 ]; then
opts="--help --pattern --stations --event --markers --follow --force-cache --store-path --store-interval --ntracks --opengl --debug"
fi
opts="$opts $(_opt_dirnames) $(_opt_filenames)"
COMPREPLY=( $(compgen -W '${opts}' $cur) )
return 0
}
complete -F _fomosto_options fomosto
complete -F _snuffler_options snuffler

2
setup.py

@ -402,7 +402,7 @@ setup(
'apps/gmtpy-epstopdf',
'apps/automap'],
data_files=[('/etc/bash_completion.d', ['extras/fomosto'])],
data_files=[('/etc/bash_completion.d', ['extras/pyrocko'])],
package_data={
packname: ['data/*.png', 'data/*.html', 'data/earthmodels/*.nd',

Loading…
Cancel
Save