/etc/bash_completion.d/code_saturne is in code-saturne-data 3.3.2-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | #------------------------------------------------------------------------------
# This file is part of the Code_Saturne Kernel, element of the
# Code_Saturne CFD tool.
#
# Copyright (C) 2009-2011 EDF S.A., France
#
# The Code_Saturne Kernel is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
#
# The Code_Saturne Kernel is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public Licence
# along with the Code_Saturne Kernel; if not, write to the
# Free Software Foundation, Inc.,
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#-------------------------------------------------------------------------------
# Batch completion script for:
# - "code_saturne" user Python script
# - "cs_solver" binary executable
_code_saturne() {
local cur prev opt cmds cmdOpts opt i
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
# Possible commands except "help", as given by "code_saturne help"
cmds="autovnv compile config create gui info run salome"
# Help and Case options
local helpOpts="-h --help"
local caseOpts="-c --case"
# Readers and guides
local readers="okular evince kpdf gpdf xpdf acroread"
local guides="refcard user theory tutorial developer Doxygen"
# Boolean values
local isCmd=0
local isOptCase=0
if [[ ${COMP_CWORD} -eq 1 ]]; then
COMPREPLY=( $(compgen -W "help ${cmds}" -- ${cur}) )
return 0
fi
# Certain tokens preclude further activity
if [[ ${prev} == @(-h|--help|-v|--version) ]]; then
return 0
fi
# Check if previous token is a command or not
[[ ${prev} == @(${cmds// /|}) ]] && isCmd=1
# Parse arguments and set various variables about what was found.
#
# cmd: the current command if available
local cmd=${COMP_WORDS[1]}
# Check options depending on the command and the previous token
case ${cmd} in
help)
case ${prev} in
help)
COMPREPLY=( $(compgen -W "${cmds}" -- ${cur}) )
return 0
;;
*) return 0;;
esac
;;
autovnv)
case ${prev} in
-f|--file) _filedir -d; return 0;;
-m|--mail) COMPREPLY=( ); return 0;;
*) cmdOpts="-q --quiet -r --run -c --compare -p --post";;
esac
;;
compile)
case ${prev} in
-d|--dest) _filedir -d; return 0;;
-s|--source) _filedir -d; return 0;;
*) cmdOpts="-t --test -f --force -k -keep-going \
-s --source -d --dest --opt-libs --syrthes";;
esac
;;
config)
case ${prev} in
--have) COMPREPLY=( ); return 0;;
--cppflags|--ldflags) COMPREPLY=( ); return 0;;
--libs|--deplibs) COMPREPLY=( ); return 0;;
*) cmdOpts="--cc --cxx --fc --cflags --cxxflags --fcflags \
--rpath --pyuic4 --pyrcc4 \
--have --cppflags --ldflags --libs --deplibs";;
esac
;;
create)
case ${prev} in
-c|--case) COMPREPLY=( ); return 0;;
-s|--study) COMPREPLY=( ); return 0;;
--syrthes|--aster) COMPREPLY=( ); return 0;;
--copy-from) _filedir -d; return 0;;
*) cmdOpts="-s --study -c --case --noref --copy-from \
--syrthes --aster -q --quiet -v --verbose";;
esac
;;
gui)
case ${prev} in
-p|--file) _filedir; return 0;;
-b|--batch) COMPREPLY=( ); return 0;;
*) cmdOpts="-p --param -n --new -z --no-splash";;
esac
;;
info)
case ${prev} in
-r|--reader)
COMPREPLY=( $(compgen -W "${readers}" -- ${cur}) )
return 0
;;
-g|--guide)
COMPREPLY=( $(compgen -W "${guides}" -- ${cur}) )
return 0
;;
*) cmdOpts="-r --reader -g --guide --version"
esac
;;
run)
case ${prev} in
-p|--param) _filedir; return 0;;
--case) _filedir -d; return 0;;
--id) COMPREPLY=( ); return 0;;
--id-prefix) COMPREPLY=( ); return 0;;
--id-suffix) COMPREPLY=( ); return 0;;
--n|--nprocs) COMPREPLY=( ); return 0;;
*) cmdOpts="-p --param --case --id --id-prefix --id-suffix \
--suggest-id --force --initialize --execute --finalize \
-n --nprocs";;
esac
;;
*)
cmdOpts=""
;;
esac
# Take out options already given
for (( i=2; i<=$COMP_CWORD-1; ++i ))
do
opt=${COMP_WORDS[$i]}
local optBase
# Remove leading dashes and arguments
case $opt in
--*) optBase=${opt/=*/} ;;
-*) optBase=${opt:0:2} ;;
esac
cmdOpts=" $cmdOpts "
cmdOpts=${cmdOpts/ ${optBase} / }
# Take out alternatives and mutually exclusives
case $optBase in
--aster) cmdOpts=${cmdOpts/ --syrthes / } ;;
-c) cmdOpts=${cmdOpts/ --case / }; isOptcase=1 ;;
--case) cmdOpts=${cmdOpts/ -c / }; isOptcase=1 ;;
-d) cmdOpts=${cmdOpts/ --dest / } ;;
--dest) cmdOpts=${cmdOpts/ -d / } ;;
-f) cmdOpts=${cmdOpts/ --file / } ;;
--file) cmdOpts=${cmdOpts/ -f / } ;;
-g) cmdOpts=${cmdOpts/ --guide / } ;;
--guide) cmdOpts=${cmdOpts/ -g / } ;;
-k) cmdOpts=${cmdOpts/ --keep-going / } ;;
--keep-going) cmdOpts=${cmdOpts/ -k / } ;;
-n) cmdOpts=${cmdOpts/ --new / } ;;
--new) cmdOpts=${cmdOpts/ -n / }
cmdOpts=${cmdOpts/ --file / } ;;
--no-splash) cmdOpts=${cmdOpts/ -z / } ;;
--opt-libs) cmdOpts=${cmdOpts/ --syrthes / } ;;
-p) cmdOpts=${cmdOpts/ --param / } ;;
--param) cmdOpts=${cmdOpts/ -p / } ;;
-q) cmdOpts=${cmdOpts/ --quiet / } ;;
--quiet) cmdOpts=${cmdOpts/ -q / } ;;
-r) cmdOpts=${cmdOpts/ --reader / } ;;
--reader) cmdOpts=${cmdOpts/ -r / } ;;
-s)
case ${cmd} in
compile) cmdOpts=${cmdOpts/ --source / } ;;
create) cmdOpts=${cmdOpts/ --study / } ;;
esac ;;
--source) cmdOpts=${cmdOpts/ -s / } ;;
--study) cmdOpts=${cmdOpts/ -s / } ;;
--syrthes)
case ${cmd} in
compile) cmdOpts=${cmdOpts/ --opt-libs / } ;;
create) cmdOpts=${cmdOpts/ --aster / } ;;
esac ;;
-t) cmdOpts=${cmdOpts/ --test / } ;;
--test) cmdOpts=${cmdOpts/ -t / } ;;
-v) cmdOpts=${cmdOpts/ --verbose / } ;;
--verbose) cmdOpts=${cmdOpts/ -v / } ;;
-z) cmdOpts=${cmdOpts/ --no-splash / } ;;
esac
done
# Add case options (may appear several times in command line)
[[ $isOptCase -eq 1 ]] && cmdOpts="${caseOpts} ${cmdOpts}"
# Add help options for every command but "help"
[[ $isCmd -eq 1 ]] && cmdOpts="${helpOpts} ${cmdOpts}"
COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "${cmdOpts}" -- ${cur}) )
}
complete -F _code_saturne code_saturne
|