equal
deleted
inserted
replaced
20 w0=${COMP_WORDS[COMP_CWORD]} |
20 w0=${COMP_WORDS[COMP_CWORD]} |
21 w1=${COMP_WORDS[COMP_CWORD-1]} |
21 w1=${COMP_WORDS[COMP_CWORD-1]} |
22 w2=${COMP_WORDS[COMP_CWORD-2]} |
22 w2=${COMP_WORDS[COMP_CWORD-2]} |
23 w3=${COMP_WORDS[COMP_CWORD-3]} |
23 w3=${COMP_WORDS[COMP_CWORD-3]} |
24 |
24 |
25 WRITE_HEADER=( |
25 BOOLEAN_VALUES=( |
26 "true" |
26 "true" |
27 "false" |
27 "false" |
28 ) |
28 ) |
29 |
29 |
30 if [[ "$w1" == "--write-header" ]]; then COMPREPLY=($(compgen -W "${WRITE_HEADER[*]}" -- "$w0")) |
30 INSERT_MODES=( |
31 elif [[ "$w1" == "--write-types" ]]; then COMPREPLY=($(compgen -W "${WRITE_HEADER[*]}" -- "$w0")) |
31 "single" |
|
32 "multi" |
|
33 ) |
|
34 |
|
35 RELPIPE_TYPES=( |
|
36 "boolean" |
|
37 "integer" |
|
38 "string" |
|
39 ) |
|
40 |
|
41 SQL_TYPES=( |
|
42 "text" |
|
43 "integer" |
|
44 "bigint" |
|
45 "numeric" |
|
46 "varchar(20)" |
|
47 "bit" |
|
48 "date" |
|
49 "time" |
|
50 "timestamp" |
|
51 ) |
|
52 |
|
53 if [[ "$w1" == "--relation" && "x$w0" == "x" ]]; then COMPREPLY=("'.*'") |
|
54 elif [[ "$w1" == "--write-ddl" ]]; then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0")) |
|
55 elif [[ "$w1" == "--write-dml" ]]; then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0")) |
|
56 elif [[ "$w1" == "--write-column-names" ]]; then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0")) |
|
57 elif [[ "$w1" == "--insert-mode" ]]; then COMPREPLY=($(compgen -W "${INSERT_MODES[*]}" -- "$w0")) |
|
58 elif [[ "$w1" == "--type-cast" && "x$w0" == "x" ]]; then COMPREPLY=("'.*'") |
|
59 elif [[ "$w2" == "--type-cast" ]]; then COMPREPLY=($(compgen -W "${RELPIPE_TYPES[*]}" -- "$w0")) |
|
60 elif [[ "$w3" == "--type-cast" ]]; then COMPREPLY=($(compgen -W "${SQL_TYPES[*]}" -- "$w0")) |
32 else |
61 else |
33 OPTIONS=( |
62 OPTIONS=( |
34 "--write-header" |
63 "--relation" |
35 "--write-types" |
64 "--write-ddl" |
|
65 "--write-dml" |
|
66 "--write-column-names" |
|
67 "--insert-mode" |
|
68 "--type-cast" |
36 ) |
69 ) |
37 COMPREPLY=($(compgen -W "${OPTIONS[*]}" -- "$w0")) |
70 COMPREPLY=($(compgen -W "${OPTIONS[*]}" -- "$w0")) |
38 fi |
71 fi |
39 } |
72 } |
40 |
73 |