diff options
author | polo <ordipolo@gmx.fr> | 2024-08-13 23:45:21 +0200 |
---|---|---|
committer | polo <ordipolo@gmx.fr> | 2024-08-13 23:45:21 +0200 |
commit | bf6655a534a6775d30cafa67bd801276bda1d98d (patch) | |
tree | c6381e3f6c81c33eab72508f410b165ba05f7e9c /vendor/symfony/console/Resources/completion.bash | |
parent | 94d67a4b51f8e62e7d518cce26a526ae1ec48278 (diff) | |
download | AppliGestionPHP-bf6655a534a6775d30cafa67bd801276bda1d98d.zip |
VERSION 0.2 doctrine ORM et entités
Diffstat (limited to 'vendor/symfony/console/Resources/completion.bash')
-rw-r--r-- | vendor/symfony/console/Resources/completion.bash | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/vendor/symfony/console/Resources/completion.bash b/vendor/symfony/console/Resources/completion.bash new file mode 100644 index 0000000..0d76eac --- /dev/null +++ b/vendor/symfony/console/Resources/completion.bash | |||
@@ -0,0 +1,94 @@ | |||
1 | # This file is part of the Symfony package. | ||
2 | # | ||
3 | # (c) Fabien Potencier <fabien@symfony.com> | ||
4 | # | ||
5 | # For the full copyright and license information, please view | ||
6 | # https://symfony.com/doc/current/contributing/code/license.html | ||
7 | |||
8 | _sf_{{ COMMAND_NAME }}() { | ||
9 | |||
10 | # Use the default completion for shell redirect operators. | ||
11 | for w in '>' '>>' '&>' '<'; do | ||
12 | if [[ $w = "${COMP_WORDS[COMP_CWORD-1]}" ]]; then | ||
13 | compopt -o filenames | ||
14 | COMPREPLY=($(compgen -f -- "${COMP_WORDS[COMP_CWORD]}")) | ||
15 | return 0 | ||
16 | fi | ||
17 | done | ||
18 | |||
19 | # Use newline as only separator to allow space in completion values | ||
20 | IFS=$'\n' | ||
21 | local sf_cmd="${COMP_WORDS[0]}" | ||
22 | |||
23 | # for an alias, get the real script behind it | ||
24 | sf_cmd_type=$(type -t $sf_cmd) | ||
25 | if [[ $sf_cmd_type == "alias" ]]; then | ||
26 | sf_cmd=$(alias $sf_cmd | sed -E "s/alias $sf_cmd='(.*)'/\1/") | ||
27 | elif [[ $sf_cmd_type == "file" ]]; then | ||
28 | sf_cmd=$(type -p $sf_cmd) | ||
29 | fi | ||
30 | |||
31 | if [[ $sf_cmd_type != "function" && ! -x $sf_cmd ]]; then | ||
32 | return 1 | ||
33 | fi | ||
34 | |||
35 | local cur prev words cword | ||
36 | _get_comp_words_by_ref -n := cur prev words cword | ||
37 | |||
38 | local completecmd=("$sf_cmd" "_complete" "--no-interaction" "-sbash" "-c$cword" "-a{{ VERSION }}") | ||
39 | for w in ${words[@]}; do | ||
40 | w=$(printf -- '%b' "$w") | ||
41 | # remove quotes from typed values | ||
42 | quote="${w:0:1}" | ||
43 | if [ "$quote" == \' ]; then | ||
44 | w="${w%\'}" | ||
45 | w="${w#\'}" | ||
46 | elif [ "$quote" == \" ]; then | ||
47 | w="${w%\"}" | ||
48 | w="${w#\"}" | ||
49 | fi | ||
50 | # empty values are ignored | ||
51 | if [ ! -z "$w" ]; then | ||
52 | completecmd+=("-i$w") | ||
53 | fi | ||
54 | done | ||
55 | |||
56 | local sfcomplete | ||
57 | if sfcomplete=$(${completecmd[@]} 2>&1); then | ||
58 | local quote suggestions | ||
59 | quote=${cur:0:1} | ||
60 | |||
61 | # Use single quotes by default if suggestions contains backslash (FQCN) | ||
62 | if [ "$quote" == '' ] && [[ "$sfcomplete" =~ \\ ]]; then | ||
63 | quote=\' | ||
64 | fi | ||
65 | |||
66 | if [ "$quote" == \' ]; then | ||
67 | # single quotes: no additional escaping (does not accept ' in values) | ||
68 | suggestions=$(for s in $sfcomplete; do printf $'%q%q%q\n' "$quote" "$s" "$quote"; done) | ||
69 | elif [ "$quote" == \" ]; then | ||
70 | # double quotes: double escaping for \ $ ` " | ||
71 | suggestions=$(for s in $sfcomplete; do | ||
72 | s=${s//\\/\\\\} | ||
73 | s=${s//\$/\\\$} | ||
74 | s=${s//\`/\\\`} | ||
75 | s=${s//\"/\\\"} | ||
76 | printf $'%q%q%q\n' "$quote" "$s" "$quote"; | ||
77 | done) | ||
78 | else | ||
79 | # no quotes: double escaping | ||
80 | suggestions=$(for s in $sfcomplete; do printf $'%q\n' $(printf '%q' "$s"); done) | ||
81 | fi | ||
82 | COMPREPLY=($(IFS=$'\n' compgen -W "$suggestions" -- $(printf -- "%q" "$cur"))) | ||
83 | __ltrim_colon_completions "$cur" | ||
84 | else | ||
85 | if [[ "$sfcomplete" != *"Command \"_complete\" is not defined."* ]]; then | ||
86 | >&2 echo | ||
87 | >&2 echo $sfcomplete | ||
88 | fi | ||
89 | |||
90 | return 1 | ||
91 | fi | ||
92 | } | ||
93 | |||
94 | complete -F _sf_{{ COMMAND_NAME }} {{ COMMAND_NAME }} | ||