MuranoCLI 3.2.1.pre.beta.6 → 3.2.1.pre.beta.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (228) hide show
  1. checksums.yaml +4 -4
  2. data/HISTORY.md +10 -0
  3. data/MuranoCLI.gemspec +37 -6
  4. data/Rakefile +38 -11
  5. data/lib/MrMurano/commands/business.rb +0 -4
  6. data/lib/MrMurano/version.rb +1 -1
  7. metadata +2 -251
  8. data/dockers/Dockerfile.2.2.9 +0 -40
  9. data/dockers/Dockerfile.2.3.6 +0 -40
  10. data/dockers/Dockerfile.2.4.3 +0 -40
  11. data/dockers/Dockerfile.2.5.0 +0 -40
  12. data/dockers/Dockerfile.GemRelease +0 -49
  13. data/dockers/Dockerfile.m4 +0 -122
  14. data/dockers/README.rst +0 -362
  15. data/dockers/RELEASE.rst +0 -135
  16. data/dockers/docker-test.sh +0 -163
  17. data/dockers/gem-release.sh +0 -4
  18. data/docs/basic_example.rst +0 -436
  19. data/docs/ci/.trustme.plugin +0 -140
  20. data/docs/ci/.trustme.sh +0 -516
  21. data/docs/ci/.trustme.vim +0 -55
  22. data/docs/completions/murano_completion-bash +0 -4484
  23. data/docs/demo.md +0 -109
  24. data/docs/develop.rst +0 -392
  25. data/docs/release.rst +0 -295
  26. data/spec/Account-Passwords_spec.rb +0 -245
  27. data/spec/Account_spec.rb +0 -256
  28. data/spec/Business_spec.rb +0 -307
  29. data/spec/ConfigFile_spec.rb +0 -55
  30. data/spec/ConfigMigrate_spec.rb +0 -108
  31. data/spec/Config_spec.rb +0 -440
  32. data/spec/Content_spec.rb +0 -422
  33. data/spec/GatewayBase_spec.rb +0 -65
  34. data/spec/GatewayDevice_spec.rb +0 -403
  35. data/spec/GatewayResource_spec.rb +0 -283
  36. data/spec/GatewaySettings_spec.rb +0 -130
  37. data/spec/HttpAuthed_spec.rb +0 -87
  38. data/spec/Http_spec.rb +0 -220
  39. data/spec/MakePretties_spec.rb +0 -127
  40. data/spec/Mock_spec.rb +0 -62
  41. data/spec/ProjectFile_spec.rb +0 -381
  42. data/spec/Setting_spec.rb +0 -120
  43. data/spec/Solution-ServiceConfig_spec.rb +0 -272
  44. data/spec/Solution-ServiceEventHandler_spec.rb +0 -442
  45. data/spec/Solution-ServiceModules_spec.rb +0 -562
  46. data/spec/Solution-UsersRoles_spec.rb +0 -269
  47. data/spec/Solution_spec.rb +0 -140
  48. data/spec/SyncRoot_spec.rb +0 -111
  49. data/spec/SyncUpDown_spec.rb +0 -868
  50. data/spec/Verbosing_spec.rb +0 -332
  51. data/spec/Webservice-Cors_spec.rb +0 -225
  52. data/spec/Webservice-Endpoint_spec.rb +0 -650
  53. data/spec/Webservice-File_spec.rb +0 -282
  54. data/spec/Webservice-Setting_spec.rb +0 -105
  55. data/spec/_workspace.rb +0 -43
  56. data/spec/cmd_business_spec.rb +0 -64
  57. data/spec/cmd_common.rb +0 -507
  58. data/spec/cmd_config_spec.rb +0 -73
  59. data/spec/cmd_content_spec.rb +0 -109
  60. data/spec/cmd_cors_spec.rb +0 -54
  61. data/spec/cmd_device_spec.rb +0 -130
  62. data/spec/cmd_domain_spec.rb +0 -62
  63. data/spec/cmd_element_spec.rb +0 -401
  64. data/spec/cmd_exchange_spec.rb +0 -114
  65. data/spec/cmd_help_spec.rb +0 -72
  66. data/spec/cmd_init_spec.rb +0 -475
  67. data/spec/cmd_keystore_spec.rb +0 -97
  68. data/spec/cmd_link_spec.rb +0 -105
  69. data/spec/cmd_logs_spec.rb +0 -162
  70. data/spec/cmd_password_spec.rb +0 -64
  71. data/spec/cmd_setting_application_spec.rb +0 -300
  72. data/spec/cmd_setting_product_spec.rb +0 -246
  73. data/spec/cmd_status_spec.rb +0 -300
  74. data/spec/cmd_syncdown_application_spec.rb +0 -128
  75. data/spec/cmd_syncdown_both_spec.rb +0 -178
  76. data/spec/cmd_syncdown_unit_spec.rb +0 -861
  77. data/spec/cmd_syncup_spec.rb +0 -148
  78. data/spec/cmd_token_spec.rb +0 -53
  79. data/spec/cmd_usage_spec.rb +0 -79
  80. data/spec/dry_run_formatter.rb +0 -28
  81. data/spec/fixtures/.mrmuranorc +0 -9
  82. data/spec/fixtures/ProjectFiles/invalid.yaml +0 -9
  83. data/spec/fixtures/ProjectFiles/only_meta.yaml +0 -24
  84. data/spec/fixtures/ProjectFiles/with_routes.yaml +0 -27
  85. data/spec/fixtures/SolutionFiles/0.2.0.json +0 -20
  86. data/spec/fixtures/SolutionFiles/0.2.0_invalid.json +0 -18
  87. data/spec/fixtures/SolutionFiles/0.2.json +0 -21
  88. data/spec/fixtures/SolutionFiles/0.3.0.json +0 -20
  89. data/spec/fixtures/SolutionFiles/0.3.0_invalid.json +0 -19
  90. data/spec/fixtures/SolutionFiles/0.3.json +0 -20
  91. data/spec/fixtures/SolutionFiles/basic.json +0 -20
  92. data/spec/fixtures/SolutionFiles/secret.json +0 -6
  93. data/spec/fixtures/configfile +0 -9
  94. data/spec/fixtures/dumped_config +0 -57
  95. data/spec/fixtures/exchange_element/element-show.json +0 -1
  96. data/spec/fixtures/exchange_element/swagger-mur-6407__10k.yaml +0 -282
  97. data/spec/fixtures/exchange_element/swagger-mur-6407__20k.yaml +0 -588
  98. data/spec/fixtures/gateway_resource_files/resources.notyaml +0 -12
  99. data/spec/fixtures/gateway_resource_files/resources.yaml +0 -13
  100. data/spec/fixtures/gateway_resource_files/resources_invalid.yaml +0 -13
  101. data/spec/fixtures/mrmuranorc_deleted_bob +0 -6
  102. data/spec/fixtures/mrmuranorc_tool_bob +0 -3
  103. data/spec/fixtures/product_spec_files/example.exoline.spec.yaml +0 -116
  104. data/spec/fixtures/product_spec_files/example.murano.spec.yaml +0 -14
  105. data/spec/fixtures/product_spec_files/gwe.exoline.spec.yaml +0 -21
  106. data/spec/fixtures/product_spec_files/gwe.murano.spec.yaml +0 -16
  107. data/spec/fixtures/product_spec_files/lightbulb-no-state.yaml +0 -11
  108. data/spec/fixtures/product_spec_files/lightbulb.yaml +0 -21
  109. data/spec/fixtures/roles-three.yaml +0 -11
  110. data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value 0.webmock +0 -98
  111. data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value 1.webmock +0 -98
  112. data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value No.webmock +0 -98
  113. data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value Yes.webmock +0 -98
  114. data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value bob.webmock +0 -72
  115. data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value false.webmock +0 -98
  116. data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value off.webmock +0 -98
  117. data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value on STDIN.webmock +0 -98
  118. data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value on.webmock +0 -98
  119. data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value true.webmock +0 -98
  120. data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a json array blob with STDIN.webmock +0 -98
  121. data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a json array blob.webmock +0 -98
  122. data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) an array.webmock +0 -98
  123. data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) appends an array.webmock +0 -98
  124. data/spec/fixtures/snapshots/murano application setting reads Webservice.cors to a file.webmock +0 -72
  125. data/spec/fixtures/snapshots/murano application setting reads Webservice.cors.webmock +0 -72
  126. data/spec/fixtures/snapshots/murano business list as json.webmock +0 -27
  127. data/spec/fixtures/snapshots/murano business list as table.webmock +0 -27
  128. data/spec/fixtures/snapshots/murano business list fewer fields.webmock +0 -27
  129. data/spec/fixtures/snapshots/murano business list only ids.webmock +0 -27
  130. data/spec/fixtures/snapshots/murano business list output to file.webmock +0 -27
  131. data/spec/fixtures/snapshots/murano business without project help.webmock +0 -9
  132. data/spec/fixtures/snapshots/murano config Needs a key.webmock +0 -9
  133. data/spec/fixtures/snapshots/murano config Reads a key.webmock +0 -9
  134. data/spec/fixtures/snapshots/murano config Removes a key.webmock +0 -9
  135. data/spec/fixtures/snapshots/murano config Sets a key.webmock +0 -9
  136. data/spec/fixtures/snapshots/murano config Sets a user key.webmock +0 -9
  137. data/spec/fixtures/snapshots/murano content life cycle.webmock +0 -144
  138. data/spec/fixtures/snapshots/murano cors sets CORS.webmock +0 -78
  139. data/spec/fixtures/snapshots/murano cors show CORS.webmock +0 -64
  140. data/spec/fixtures/snapshots/murano device activates.webmock +0 -86
  141. data/spec/fixtures/snapshots/murano device enables a batch.webmock +0 -76
  142. data/spec/fixtures/snapshots/murano device enables and lists.webmock +0 -78
  143. data/spec/fixtures/snapshots/murano device writes and reads.webmock +0 -136
  144. data/spec/fixtures/snapshots/murano domain show domain.webmock +0 -101
  145. data/spec/fixtures/snapshots/murano element edit unknown as unknown element.webmock +0 -43
  146. data/spec/fixtures/snapshots/murano element show --help.webmock +0 -9
  147. data/spec/fixtures/snapshots/murano element show as csv.webmock +0 -43
  148. data/spec/fixtures/snapshots/murano element show as default-table.webmock +0 -43
  149. data/spec/fixtures/snapshots/murano element show as json.webmock +0 -43
  150. data/spec/fixtures/snapshots/murano element show as table truncate.webmock +0 -43
  151. data/spec/fixtures/snapshots/murano element show as table wrap.webmock +0 -43
  152. data/spec/fixtures/snapshots/murano element show as yaml.webmock +0 -43
  153. data/spec/fixtures/snapshots/murano element show using ambiguous name.webmock +0 -43
  154. data/spec/fixtures/snapshots/murano element without project usage.webmock +0 -9
  155. data/spec/fixtures/snapshots/murano exchange with project list as json.webmock +0 -59
  156. data/spec/fixtures/snapshots/murano exchange with project list as table.webmock +0 -59
  157. data/spec/fixtures/snapshots/murano exchange with project list fewer fields.webmock +0 -59
  158. data/spec/fixtures/snapshots/murano exchange with project list only ids.webmock +0 -59
  159. data/spec/fixtures/snapshots/murano exchange with project list output to file.webmock +0 -59
  160. data/spec/fixtures/snapshots/murano exchange with project list purchase is already added ID.webmock +0 -83
  161. data/spec/fixtures/snapshots/murano exchange with project list purchase is ambiguous name.webmock +0 -59
  162. data/spec/fixtures/snapshots/murano exchange without project help.webmock +0 -9
  163. data/spec/fixtures/snapshots/murano help using commander as --help.webmock +0 -9
  164. data/spec/fixtures/snapshots/murano help using commander no args.webmock +0 -9
  165. data/spec/fixtures/snapshots/murano help using subshell no args.webmock +0 -9
  166. data/spec/fixtures/snapshots/murano help using subshell with --help.webmock +0 -9
  167. data/spec/fixtures/snapshots/murano init Won't init in HOME (gracefully).webmock +0 -9
  168. data/spec/fixtures/snapshots/murano init in empty directory with existing project.webmock +0 -201
  169. data/spec/fixtures/snapshots/murano init in empty directory without existing project.webmock +0 -193
  170. data/spec/fixtures/snapshots/murano init in existing project directory with ProjectFile.webmock +0 -213
  171. data/spec/fixtures/snapshots/murano init in existing project directory with SolutionFile 0.2.0.webmock +0 -213
  172. data/spec/fixtures/snapshots/murano init in existing project directory with SolutionFile 0.3.0.webmock +0 -213
  173. data/spec/fixtures/snapshots/murano init in existing project directory without ProjectFile.webmock +0 -213
  174. data/spec/fixtures/snapshots/murano keystore can call other commands.webmock +0 -108
  175. data/spec/fixtures/snapshots/murano keystore clearAll.webmock +0 -124
  176. data/spec/fixtures/snapshots/murano keystore deletes.webmock +0 -112
  177. data/spec/fixtures/snapshots/murano keystore gets.webmock +0 -96
  178. data/spec/fixtures/snapshots/murano keystore infos.webmock +0 -96
  179. data/spec/fixtures/snapshots/murano keystore lists.webmock +0 -96
  180. data/spec/fixtures/snapshots/murano link with project links and lists.webmock +0 -149
  181. data/spec/fixtures/snapshots/murano link with project unlinks.webmock +0 -165
  182. data/spec/fixtures/snapshots/murano link without project help.webmock +0 -9
  183. data/spec/fixtures/snapshots/murano link without project subshell vs inline using commander will not list.webmock +0 -27
  184. data/spec/fixtures/snapshots/murano link without project subshell vs inline using subshell will not list.webmock +0 -27
  185. data/spec/fixtures/snapshots/murano logs when project is setup tail log.webmock +0 -9
  186. data/spec/fixtures/snapshots/murano password Lists when no file.webmock +0 -9
  187. data/spec/fixtures/snapshots/murano password deletes a password.webmock +0 -9
  188. data/spec/fixtures/snapshots/murano password sets a password.webmock +0 -9
  189. data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a forced string value on STDIN.webmock +0 -90
  190. data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a forced string value.webmock +0 -90
  191. data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a number value fiftyHalf.webmock +0 -64
  192. data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a number value float 12.67.webmock +0 -90
  193. data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a number value integer 12.webmock +0 -90
  194. data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a number value on STDIN.webmock +0 -90
  195. data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a string value.webmock +0 -90
  196. data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) merges into a dictionary.webmock +0 -90
  197. data/spec/fixtures/snapshots/murano single sync without ProjectFile syncdown.webmock +0 -322
  198. data/spec/fixtures/snapshots/murano status with ProjectFile status.webmock +0 -153
  199. data/spec/fixtures/snapshots/murano status with Solutionfile 0.2.0 status.webmock +0 -153
  200. data/spec/fixtures/snapshots/murano status with Solutionfile 0.3.0 status.webmock +0 -153
  201. data/spec/fixtures/snapshots/murano status without ProjectFile matches file path.webmock +0 -153
  202. data/spec/fixtures/snapshots/murano status without ProjectFile matches route.webmock +0 -153
  203. data/spec/fixtures/snapshots/murano status without ProjectFile status.webmock +0 -153
  204. data/spec/fixtures/snapshots/murano syncdown stubbed without ProjectFile syncdown.webmock +0 -151
  205. data/spec/fixtures/snapshots/murano syncdown without ProjectFile syncdown.webmock +0 -479
  206. data/spec/fixtures/snapshots/murano syncup without ProjectFile syncup.webmock +0 -357
  207. data/spec/fixtures/snapshots/murano token with project list as table.webmock +0 -9
  208. data/spec/fixtures/snapshots/murano token without project help.webmock +0 -9
  209. data/spec/fixtures/snapshots/murano usage show usage.webmock +0 -93
  210. data/spec/fixtures/syncable_conflict/services/devdata.lua +0 -18
  211. data/spec/fixtures/syncable_conflict/services/timers.lua +0 -4
  212. data/spec/fixtures/syncable_content/assets/icon.png +0 -0
  213. data/spec/fixtures/syncable_content/assets/index.html +0 -0
  214. data/spec/fixtures/syncable_content/assets/js/script.js +0 -0
  215. data/spec/fixtures/syncable_content/modules/table_util.lua +0 -58
  216. data/spec/fixtures/syncable_content/routes/manyRoutes.lua +0 -11
  217. data/spec/fixtures/syncable_content/routes/singleRoute.lua +0 -5
  218. data/spec/fixtures/websocket/README.rst +0 -110
  219. data/spec/fixtures/websocket/logs_blather.rb +0 -27
  220. data/spec/fixtures/websocket/logs_faker.rb +0 -153
  221. data/spec/fixtures/websocket/simple_connection.rb +0 -45
  222. data/spec/fixtures/websocket/simple_options.rb +0 -77
  223. data/spec/fixtures/websocket/simple_server.rb +0 -69
  224. data/spec/fixtures/websocket/wss-echo.rb +0 -48
  225. data/spec/fixtures/websocket/wss-fake-logs.rb +0 -20
  226. data/spec/spec_helper.rb +0 -131
  227. data/spec/variegated_TruthyFalsey_spec.rb +0 -29
  228. data/spec/webmock_snapshot.rb +0 -296
data/docs/ci/.trustme.vim DELETED
@@ -1,55 +0,0 @@
1
- " 2017-08-02: Aha! EZ-CI at last!
2
-
3
- " USAGE: See: .trustme.sh
4
-
5
- "echomsg "You've been Vimmed! at " . expand('%')
6
-
7
- " 2017-11-08: I had wanted to use autocmd, I guess, to have tags
8
- " apply to just files within a project, but that's not working so
9
- " well -- this plugin might be triggered by BufEnter, so the tags=
10
- " wouldn't get set until the user re-enters the buffer...
11
-
12
- " @% is same as expand('%'), which for some miraculous reason
13
- " is the path relative to this file??
14
- "autocmd BufWrite *.rb echomsg "Hooray! at " . expand('%')
15
- "autocmd BufWrite *.rb echomsg "Hooray! at " . @%
16
-
17
- " Use an autocmd group so it's easy to delete the group,
18
- " since every time we call autocmd, the command is appended,
19
- " and this file gets sourced on every switch to a corresponding
20
- " project buffer.
21
- "augroup trustme
22
- " " Remove! all trustme autocommands.
23
- " autocmd! trustme
24
- "
25
- " "autocmd BufWrite *.rb silent !touch TOUCH
26
- " "autocmd BufWrite <buffer> echom "trustme is hooked!"
27
- " " MEH/2017-08-02: This won't hook bin/murano.
28
- "" autocmd BufWrite <buffer> silent !./.trustme.sh &
29
- " autocmd BufWritePost <buffer> silent !./.trustme.sh &
30
- "augroup END
31
-
32
- " NOTE: The tags path cannot be relative.
33
- autocmd BufRead *.rb set tags=/exo/clients/exosite/exosite-murcli/tags
34
-
35
- "echomsg 'Calling trustme.sh'
36
- "echomsg "g:DUBS_TRUST_ME_ON_SAVE: " . g:DUBS_TRUST_ME_ON_SAVE
37
- "silent !./.trustme.sh &
38
- "silent !/exo/clients/exosite/exosite-murcli/.trustme.sh &
39
-
40
- " If you open from project.vim (via the magic in=""),
41
- " then neither of these globals will have been set
42
- " by dubs_edit_juice.vim.
43
- if !exists("g:DUBS_TRUST_ME_ON_FILE")
44
- let g:DUBS_TRUST_ME_ON_FILE = '<project.vim>'
45
- endif
46
- if !exists("g:DUBS_TRUST_ME_ON_SAVE")
47
- let g:DUBS_TRUST_ME_ON_SAVE = 0
48
- endif
49
-
50
- let s:cmd = '!' .
51
- \ ' DUBS_TRUST_ME_ON_FILE=' . shellescape(g:DUBS_TRUST_ME_ON_FILE) .
52
- \ ' DUBS_TRUST_ME_ON_SAVE=' . shellescape(g:DUBS_TRUST_ME_ON_SAVE) .
53
- \ ' /exo/clients/exosite/exosite-murcli/.trustme.sh &'
54
- silent exec s:cmd
55
-
@@ -1,4484 +0,0 @@
1
- #!/bin/bash
2
- # Bash completion (compspec) for murano.
3
- # vim: set ai et sw=2 ts=2 ft=bash
4
- # #ft=eruby
5
-
6
- #__murano_common_options=(
7
- __app_switches=(
8
- --no-color
9
- --config
10
- --configfile
11
- --curl
12
- --dry
13
- --csv
14
- --json
15
- --yaml
16
- --pp
17
- --exclude-scopes
18
- --no-page
19
- --no-plugins
20
- --no-progress
21
- --no-ascii
22
- --verbose
23
- --debug
24
- --sid
25
- --no-token
26
- --no-basic
27
- --no-login
28
- --no-cache
29
- --ttl
30
- --help
31
- --version
32
- --trace
33
- )
34
-
35
- # Util. fcn.
36
- function contains_element () {
37
- local e
38
- for e in "${@:2}"; do [[ "$e" == "$1" ]] && return 0; done
39
- return 1
40
- }
41
-
42
- # Completion "main".
43
- function _murano () {
44
- #local cmd0="${1##*/}"
45
- local cmd0=""
46
- local cmd1=""
47
- local cmd2=""
48
- #local -a cmdn
49
- local last="${COMP_WORDS[COMP_CWORD]}"
50
- local line="${COMP_LINE}"
51
- local -a used_switches
52
-
53
- local len=$(($COMP_CWORD - 1))
54
- local idx
55
- for ((idx=1; idx<=len; idx++)); do
56
- local cur="${COMP_WORDS[$idx]}"
57
- # If positional argument is not a flag, it's the command or subcommand.
58
- if [[ $cur != -* ]]; then
59
- if [[ -z $cmd0 ]]; then
60
- cmd0="$cur"
61
- elif [[ -z $cmd1 ]]; then
62
- cmd1="$cur"
63
- elif [[ -z $cmd2 ]]; then
64
- cmd2="$cur"
65
- #else
66
- # cmdn+=("$cur")
67
- fi
68
- else
69
- used_switches+=("$cur")
70
- fi
71
- done
72
- #>&2 echo -e "\ncmd0=$cmd0 / cmd1=$cmd1 / cmd2=$cmd2 / len=$len"
73
-
74
- if [[ -z $cmd0 ]]; then
75
- local -a comp_list
76
- comp_list=(
77
- _s
78
- application
79
- applications
80
- assign
81
- banner
82
- business
83
- businesses
84
- child
85
- completion
86
- config
87
- content
88
- cors
89
- create
90
- delete
91
- device
92
- devices
93
- diff
94
- domain
95
- element
96
- exchange
97
- find
98
- help
99
- init
100
- keystore
101
- link
102
- links
103
- list
104
- login
105
- logout
106
- logs
107
- mock
108
- network
109
- password
110
- passwords
111
- plugin
112
- postgresql
113
- product
114
- products
115
- pull
116
- push
117
- service
118
- services
119
- setting
120
- settings
121
- show
122
- solution
123
- solutions
124
- status
125
- syncdown
126
- syncup
127
- token
128
- tokens
129
- tsdb
130
- usage
131
- whoami
132
- )
133
-
134
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
135
- local switch=${__app_switches[$idx]}
136
- if ! contains_element "$switch" "${used_switches[@]}"; then
137
- comp_list+=("$switch")
138
- fi
139
- done
140
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "$last"))
141
- else
142
- case $cmd0 in
143
- (_s)
144
- __murano-_s "$cmd1" "$cmd2" "${used_switches[@]}"
145
- ;;
146
- (application)
147
- __murano-application "$cmd1" "$cmd2" "${used_switches[@]}"
148
- ;;
149
- (applications)
150
- __murano-applications "$cmd1" "$cmd2" "${used_switches[@]}"
151
- ;;
152
- (assign)
153
- __murano-assign "$cmd1" "$cmd2" "${used_switches[@]}"
154
- ;;
155
- (banner)
156
- __murano-banner "$cmd1" "$cmd2" "${used_switches[@]}"
157
- ;;
158
- (business)
159
- __murano-business "$cmd1" "$cmd2" "${used_switches[@]}"
160
- ;;
161
- (businesses)
162
- __murano-businesses "$cmd1" "$cmd2" "${used_switches[@]}"
163
- ;;
164
- (child)
165
- __murano-child "$cmd1" "$cmd2" "${used_switches[@]}"
166
- ;;
167
- (completion)
168
- __murano-completion "$cmd1" "$cmd2" "${used_switches[@]}"
169
- ;;
170
- (config)
171
- __murano-config "$cmd1" "$cmd2" "${used_switches[@]}"
172
- ;;
173
- (content)
174
- __murano-content "$cmd1" "$cmd2" "${used_switches[@]}"
175
- ;;
176
- (cors)
177
- __murano-cors "$cmd1" "$cmd2" "${used_switches[@]}"
178
- ;;
179
- (create)
180
- __murano-create "$cmd1" "$cmd2" "${used_switches[@]}"
181
- ;;
182
- (delete)
183
- __murano-delete "$cmd1" "$cmd2" "${used_switches[@]}"
184
- ;;
185
- (device)
186
- __murano-device "$cmd1" "$cmd2" "${used_switches[@]}"
187
- ;;
188
- (devices)
189
- __murano-devices "$cmd1" "$cmd2" "${used_switches[@]}"
190
- ;;
191
- (diff)
192
- __murano-diff "$cmd1" "$cmd2" "${used_switches[@]}"
193
- ;;
194
- (domain)
195
- __murano-domain "$cmd1" "$cmd2" "${used_switches[@]}"
196
- ;;
197
- (element)
198
- __murano-element "$cmd1" "$cmd2" "${used_switches[@]}"
199
- ;;
200
- (exchange)
201
- __murano-exchange "$cmd1" "$cmd2" "${used_switches[@]}"
202
- ;;
203
- (find)
204
- __murano-find "$cmd1" "$cmd2" "${used_switches[@]}"
205
- ;;
206
- (help)
207
- __murano-help "$cmd1" "$cmd2" "${used_switches[@]}"
208
- ;;
209
- (init)
210
- __murano-init "$cmd1" "$cmd2" "${used_switches[@]}"
211
- ;;
212
- (keystore)
213
- __murano-keystore "$cmd1" "$cmd2" "${used_switches[@]}"
214
- ;;
215
- (link)
216
- __murano-link "$cmd1" "$cmd2" "${used_switches[@]}"
217
- ;;
218
- (links)
219
- __murano-links "$cmd1" "$cmd2" "${used_switches[@]}"
220
- ;;
221
- (list)
222
- __murano-list "$cmd1" "$cmd2" "${used_switches[@]}"
223
- ;;
224
- (login)
225
- __murano-login "$cmd1" "$cmd2" "${used_switches[@]}"
226
- ;;
227
- (logout)
228
- __murano-logout "$cmd1" "$cmd2" "${used_switches[@]}"
229
- ;;
230
- (logs)
231
- __murano-logs "$cmd1" "$cmd2" "${used_switches[@]}"
232
- ;;
233
- (mock)
234
- __murano-mock "$cmd1" "$cmd2" "${used_switches[@]}"
235
- ;;
236
- (network)
237
- __murano-network "$cmd1" "$cmd2" "${used_switches[@]}"
238
- ;;
239
- (password)
240
- __murano-password "$cmd1" "$cmd2" "${used_switches[@]}"
241
- ;;
242
- (passwords)
243
- __murano-passwords "$cmd1" "$cmd2" "${used_switches[@]}"
244
- ;;
245
- (plugin)
246
- __murano-plugin "$cmd1" "$cmd2" "${used_switches[@]}"
247
- ;;
248
- (postgresql)
249
- __murano-postgresql "$cmd1" "$cmd2" "${used_switches[@]}"
250
- ;;
251
- (product)
252
- __murano-product "$cmd1" "$cmd2" "${used_switches[@]}"
253
- ;;
254
- (products)
255
- __murano-products "$cmd1" "$cmd2" "${used_switches[@]}"
256
- ;;
257
- (pull)
258
- __murano-pull "$cmd1" "$cmd2" "${used_switches[@]}"
259
- ;;
260
- (push)
261
- __murano-push "$cmd1" "$cmd2" "${used_switches[@]}"
262
- ;;
263
- (service)
264
- __murano-service "$cmd1" "$cmd2" "${used_switches[@]}"
265
- ;;
266
- (services)
267
- __murano-services "$cmd1" "$cmd2" "${used_switches[@]}"
268
- ;;
269
- (setting)
270
- __murano-setting "$cmd1" "$cmd2" "${used_switches[@]}"
271
- ;;
272
- (settings)
273
- __murano-settings "$cmd1" "$cmd2" "${used_switches[@]}"
274
- ;;
275
- (show)
276
- __murano-show "$cmd1" "$cmd2" "${used_switches[@]}"
277
- ;;
278
- (solution)
279
- __murano-solution "$cmd1" "$cmd2" "${used_switches[@]}"
280
- ;;
281
- (solutions)
282
- __murano-solutions "$cmd1" "$cmd2" "${used_switches[@]}"
283
- ;;
284
- (status)
285
- __murano-status "$cmd1" "$cmd2" "${used_switches[@]}"
286
- ;;
287
- (syncdown)
288
- __murano-syncdown "$cmd1" "$cmd2" "${used_switches[@]}"
289
- ;;
290
- (syncup)
291
- __murano-syncup "$cmd1" "$cmd2" "${used_switches[@]}"
292
- ;;
293
- (token)
294
- __murano-token "$cmd1" "$cmd2" "${used_switches[@]}"
295
- ;;
296
- (tokens)
297
- __murano-tokens "$cmd1" "$cmd2" "${used_switches[@]}"
298
- ;;
299
- (tsdb)
300
- __murano-tsdb "$cmd1" "$cmd2" "${used_switches[@]}"
301
- ;;
302
- (usage)
303
- __murano-usage "$cmd1" "$cmd2" "${used_switches[@]}"
304
- ;;
305
- (whoami)
306
- __murano-whoami "$cmd1" "$cmd2" "${used_switches[@]}"
307
- ;;
308
- esac
309
- fi
310
- }
311
-
312
- # Completion for subcommand: "_s".
313
- function __murano-_s () {
314
- local subcmd1="$1"
315
- local subcmd2="$2"
316
- #local subcmdn="$3"
317
- local used_switches="${@:3}"
318
- local last="${COMP_WORDS[COMP_CWORD]}"
319
- local len=$(($COMP_CWORD - 1))
320
-
321
- local -a more_switches
322
-
323
- local -a comp_list
324
-
325
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
326
- #>&2 echo "used_switches=$used_switches"
327
- #>&2 echo "more_switches=$more_switches"
328
-
329
- # NOTE: Not doing anything special for ${subcmd2}.
330
- # Are there sub-sub-commands we shoud list?
331
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
332
- comp_list=(
333
- dump
334
- off
335
- on
336
- )
337
- else
338
- case $subcmd1 in
339
- (dump)
340
- more_switches=(
341
- )
342
- ;;
343
- (off)
344
- more_switches=(
345
- )
346
- ;;
347
- (on)
348
- more_switches=(
349
- )
350
- ;;
351
- esac
352
- fi
353
-
354
- # Add unused application-wide flags.
355
- local idx
356
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
357
- local switch=${__app_switches[$idx]}
358
- if ! contains_element "$switch" "${used_switches[@]}"; then
359
- comp_list+=("$switch")
360
- fi
361
- done
362
- # Add unused subcommand flags.
363
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
364
- local switch=${more_switches[$idx]}
365
- comp_list+=("$switch")
366
- done
367
-
368
- # If there are only --flags, <TAB> will put the common prefix,
369
- # "--", but maybe the user doesn't want to add a flag after all.
370
- if [[ -z ${last} ]]; then
371
- local flags_only=true
372
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
373
- local switch=${comp_list[$idx]}
374
- if [[ ${switch} != --* ]]; then
375
- flags_only=false
376
- break
377
- fi
378
- done
379
- if ${flags_only}; then
380
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
381
- comp_list+=("  ")
382
- fi
383
- fi
384
-
385
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
386
- }
387
-
388
- # Completion for subcommand: "application".
389
- function __murano-application () {
390
- local subcmd1="$1"
391
- local subcmd2="$2"
392
- #local subcmdn="$3"
393
- local used_switches="${@:3}"
394
- local last="${COMP_WORDS[COMP_CWORD]}"
395
- local len=$(($COMP_CWORD - 1))
396
-
397
- local -a more_switches
398
-
399
- local -a comp_list
400
-
401
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
402
- #>&2 echo "used_switches=$used_switches"
403
- #>&2 echo "more_switches=$more_switches"
404
-
405
- # NOTE: Not doing anything special for ${subcmd2}.
406
- # Are there sub-sub-commands we shoud list?
407
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
408
- comp_list=(
409
- create
410
- delete
411
- diff
412
- domain
413
- find
414
- list
415
- logs
416
- pull
417
- push
418
- usage
419
- )
420
- else
421
- case $subcmd1 in
422
- (create)
423
- more_switches=(
424
- {--trace}
425
- )
426
- ;;
427
- (delete)
428
- more_switches=(
429
- {--trace}
430
- )
431
- ;;
432
- (diff)
433
- more_switches=(
434
- {--trace}
435
- )
436
- ;;
437
- (domain)
438
- more_switches=(
439
- {--trace}
440
- )
441
- ;;
442
- (find)
443
- more_switches=(
444
- {--trace}
445
- )
446
- ;;
447
- (list)
448
- more_switches=(
449
- {--trace}
450
- )
451
- ;;
452
- (logs)
453
- more_switches=(
454
- {--trace}
455
- )
456
- ;;
457
- (pull)
458
- more_switches=(
459
- {--trace}
460
- )
461
- ;;
462
- (push)
463
- more_switches=(
464
- {--trace}
465
- )
466
- ;;
467
- (usage)
468
- more_switches=(
469
- {--trace}
470
- )
471
- ;;
472
- esac
473
- fi
474
-
475
- # Add unused application-wide flags.
476
- local idx
477
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
478
- local switch=${__app_switches[$idx]}
479
- if ! contains_element "$switch" "${used_switches[@]}"; then
480
- comp_list+=("$switch")
481
- fi
482
- done
483
- # Add unused subcommand flags.
484
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
485
- local switch=${more_switches[$idx]}
486
- comp_list+=("$switch")
487
- done
488
-
489
- # If there are only --flags, <TAB> will put the common prefix,
490
- # "--", but maybe the user doesn't want to add a flag after all.
491
- if [[ -z ${last} ]]; then
492
- local flags_only=true
493
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
494
- local switch=${comp_list[$idx]}
495
- if [[ ${switch} != --* ]]; then
496
- flags_only=false
497
- break
498
- fi
499
- done
500
- if ${flags_only}; then
501
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
502
- comp_list+=("  ")
503
- fi
504
- fi
505
-
506
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
507
- }
508
-
509
- # Completion for subcommand: "applications".
510
- function __murano-applications () {
511
- local subcmd1="$1"
512
- local subcmd2="$2"
513
- #local subcmdn="$3"
514
- local used_switches="${@:3}"
515
- local last="${COMP_WORDS[COMP_CWORD]}"
516
- local len=$(($COMP_CWORD - 1))
517
-
518
- local -a more_switches
519
-
520
- local -a comp_list
521
-
522
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
523
- #>&2 echo "used_switches=$used_switches"
524
- #>&2 echo "more_switches=$more_switches"
525
-
526
- # NOTE: Not doing anything special for ${subcmd2}.
527
- # Are there sub-sub-commands we shoud list?
528
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
529
- comp_list=(
530
- list
531
- )
532
- else
533
- case $subcmd1 in
534
- (list)
535
- more_switches=(
536
- {--trace}
537
- )
538
- ;;
539
- esac
540
- fi
541
-
542
- # Add unused application-wide flags.
543
- local idx
544
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
545
- local switch=${__app_switches[$idx]}
546
- if ! contains_element "$switch" "${used_switches[@]}"; then
547
- comp_list+=("$switch")
548
- fi
549
- done
550
- # Add unused subcommand flags.
551
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
552
- local switch=${more_switches[$idx]}
553
- comp_list+=("$switch")
554
- done
555
-
556
- # If there are only --flags, <TAB> will put the common prefix,
557
- # "--", but maybe the user doesn't want to add a flag after all.
558
- if [[ -z ${last} ]]; then
559
- local flags_only=true
560
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
561
- local switch=${comp_list[$idx]}
562
- if [[ ${switch} != --* ]]; then
563
- flags_only=false
564
- break
565
- fi
566
- done
567
- if ${flags_only}; then
568
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
569
- comp_list+=("  ")
570
- fi
571
- fi
572
-
573
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
574
- }
575
-
576
- # Completion for subcommand: "assign".
577
- function __murano-assign () {
578
- local subcmd1="$1"
579
- local subcmd2="$2"
580
- #local subcmdn="$3"
581
- local used_switches="${@:3}"
582
- local last="${COMP_WORDS[COMP_CWORD]}"
583
- local len=$(($COMP_CWORD - 1))
584
-
585
- local -a more_switches
586
-
587
- local -a comp_list
588
-
589
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
590
- #>&2 echo "used_switches=$used_switches"
591
- #>&2 echo "more_switches=$more_switches"
592
-
593
- # NOTE: Not doing anything special for ${subcmd2}.
594
- # Are there sub-sub-commands we shoud list?
595
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
596
- comp_list=(
597
- list
598
- set
599
- unset
600
- )
601
- else
602
- case $subcmd1 in
603
- (list)
604
- more_switches=(
605
- {--trace}
606
- )
607
- ;;
608
- (set)
609
- more_switches=(
610
- {--trace}
611
- )
612
- ;;
613
- (unset)
614
- more_switches=(
615
- {--trace}
616
- )
617
- ;;
618
- esac
619
- fi
620
-
621
- # Add unused application-wide flags.
622
- local idx
623
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
624
- local switch=${__app_switches[$idx]}
625
- if ! contains_element "$switch" "${used_switches[@]}"; then
626
- comp_list+=("$switch")
627
- fi
628
- done
629
- # Add unused subcommand flags.
630
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
631
- local switch=${more_switches[$idx]}
632
- comp_list+=("$switch")
633
- done
634
-
635
- # If there are only --flags, <TAB> will put the common prefix,
636
- # "--", but maybe the user doesn't want to add a flag after all.
637
- if [[ -z ${last} ]]; then
638
- local flags_only=true
639
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
640
- local switch=${comp_list[$idx]}
641
- if [[ ${switch} != --* ]]; then
642
- flags_only=false
643
- break
644
- fi
645
- done
646
- if ${flags_only}; then
647
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
648
- comp_list+=("  ")
649
- fi
650
- fi
651
-
652
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
653
- }
654
-
655
- # Completion for subcommand: "banner".
656
- function __murano-banner () {
657
- local subcmd1="$1"
658
- local subcmd2="$2"
659
- #local subcmdn="$3"
660
- local used_switches="${@:3}"
661
- local last="${COMP_WORDS[COMP_CWORD]}"
662
- local len=$(($COMP_CWORD - 1))
663
-
664
- local -a more_switches
665
-
666
- local -a comp_list
667
-
668
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
669
- #>&2 echo "used_switches=$used_switches"
670
- #>&2 echo "more_switches=$more_switches"
671
-
672
- # NOTE: Not doing anything special for ${subcmd2}.
673
- # Are there sub-sub-commands we shoud list?
674
-
675
- # Add unused application-wide flags.
676
- local idx
677
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
678
- local switch=${__app_switches[$idx]}
679
- if ! contains_element "$switch" "${used_switches[@]}"; then
680
- comp_list+=("$switch")
681
- fi
682
- done
683
- # Add unused subcommand flags.
684
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
685
- local switch=${more_switches[$idx]}
686
- comp_list+=("$switch")
687
- done
688
-
689
- # If there are only --flags, <TAB> will put the common prefix,
690
- # "--", but maybe the user doesn't want to add a flag after all.
691
- if [[ -z ${last} ]]; then
692
- local flags_only=true
693
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
694
- local switch=${comp_list[$idx]}
695
- if [[ ${switch} != --* ]]; then
696
- flags_only=false
697
- break
698
- fi
699
- done
700
- if ${flags_only}; then
701
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
702
- comp_list+=("  ")
703
- fi
704
- fi
705
-
706
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
707
- }
708
-
709
- # Completion for subcommand: "business".
710
- function __murano-business () {
711
- local subcmd1="$1"
712
- local subcmd2="$2"
713
- #local subcmdn="$3"
714
- local used_switches="${@:3}"
715
- local last="${COMP_WORDS[COMP_CWORD]}"
716
- local len=$(($COMP_CWORD - 1))
717
-
718
- local -a more_switches
719
-
720
- local -a comp_list
721
-
722
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
723
- #>&2 echo "used_switches=$used_switches"
724
- #>&2 echo "more_switches=$more_switches"
725
-
726
- # NOTE: Not doing anything special for ${subcmd2}.
727
- # Are there sub-sub-commands we shoud list?
728
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
729
- comp_list=(
730
- find
731
- list
732
- )
733
- else
734
- case $subcmd1 in
735
- (find)
736
- more_switches=(
737
- {--trace}
738
- )
739
- ;;
740
- (list)
741
- more_switches=(
742
- {--trace}
743
- )
744
- ;;
745
- esac
746
- fi
747
-
748
- # Add unused application-wide flags.
749
- local idx
750
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
751
- local switch=${__app_switches[$idx]}
752
- if ! contains_element "$switch" "${used_switches[@]}"; then
753
- comp_list+=("$switch")
754
- fi
755
- done
756
- # Add unused subcommand flags.
757
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
758
- local switch=${more_switches[$idx]}
759
- comp_list+=("$switch")
760
- done
761
-
762
- # If there are only --flags, <TAB> will put the common prefix,
763
- # "--", but maybe the user doesn't want to add a flag after all.
764
- if [[ -z ${last} ]]; then
765
- local flags_only=true
766
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
767
- local switch=${comp_list[$idx]}
768
- if [[ ${switch} != --* ]]; then
769
- flags_only=false
770
- break
771
- fi
772
- done
773
- if ${flags_only}; then
774
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
775
- comp_list+=("  ")
776
- fi
777
- fi
778
-
779
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
780
- }
781
-
782
- # Completion for subcommand: "businesses".
783
- function __murano-businesses () {
784
- local subcmd1="$1"
785
- local subcmd2="$2"
786
- #local subcmdn="$3"
787
- local used_switches="${@:3}"
788
- local last="${COMP_WORDS[COMP_CWORD]}"
789
- local len=$(($COMP_CWORD - 1))
790
-
791
- local -a more_switches
792
-
793
- local -a comp_list
794
-
795
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
796
- #>&2 echo "used_switches=$used_switches"
797
- #>&2 echo "more_switches=$more_switches"
798
-
799
- # NOTE: Not doing anything special for ${subcmd2}.
800
- # Are there sub-sub-commands we shoud list?
801
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
802
- comp_list=(
803
- list
804
- )
805
- else
806
- case $subcmd1 in
807
- (list)
808
- more_switches=(
809
- {--trace}
810
- )
811
- ;;
812
- esac
813
- fi
814
-
815
- # Add unused application-wide flags.
816
- local idx
817
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
818
- local switch=${__app_switches[$idx]}
819
- if ! contains_element "$switch" "${used_switches[@]}"; then
820
- comp_list+=("$switch")
821
- fi
822
- done
823
- # Add unused subcommand flags.
824
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
825
- local switch=${more_switches[$idx]}
826
- comp_list+=("$switch")
827
- done
828
-
829
- # If there are only --flags, <TAB> will put the common prefix,
830
- # "--", but maybe the user doesn't want to add a flag after all.
831
- if [[ -z ${last} ]]; then
832
- local flags_only=true
833
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
834
- local switch=${comp_list[$idx]}
835
- if [[ ${switch} != --* ]]; then
836
- flags_only=false
837
- break
838
- fi
839
- done
840
- if ${flags_only}; then
841
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
842
- comp_list+=("  ")
843
- fi
844
- fi
845
-
846
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
847
- }
848
-
849
- # Completion for subcommand: "child".
850
- function __murano-child () {
851
- local subcmd1="$1"
852
- local subcmd2="$2"
853
- #local subcmdn="$3"
854
- local used_switches="${@:3}"
855
- local last="${COMP_WORDS[COMP_CWORD]}"
856
- local len=$(($COMP_CWORD - 1))
857
-
858
- local -a more_switches
859
-
860
- local -a comp_list
861
-
862
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
863
- #>&2 echo "used_switches=$used_switches"
864
- #>&2 echo "more_switches=$more_switches"
865
-
866
- # NOTE: Not doing anything special for ${subcmd2}.
867
- # Are there sub-sub-commands we shoud list?
868
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
869
- comp_list=(
870
- add
871
- remove
872
- show
873
- )
874
- else
875
- case $subcmd1 in
876
- (add)
877
- more_switches=(
878
- )
879
- ;;
880
- (remove)
881
- more_switches=(
882
- )
883
- ;;
884
- (show)
885
- more_switches=(
886
- )
887
- ;;
888
- esac
889
- fi
890
-
891
- # Add unused application-wide flags.
892
- local idx
893
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
894
- local switch=${__app_switches[$idx]}
895
- if ! contains_element "$switch" "${used_switches[@]}"; then
896
- comp_list+=("$switch")
897
- fi
898
- done
899
- # Add unused subcommand flags.
900
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
901
- local switch=${more_switches[$idx]}
902
- comp_list+=("$switch")
903
- done
904
-
905
- # If there are only --flags, <TAB> will put the common prefix,
906
- # "--", but maybe the user doesn't want to add a flag after all.
907
- if [[ -z ${last} ]]; then
908
- local flags_only=true
909
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
910
- local switch=${comp_list[$idx]}
911
- if [[ ${switch} != --* ]]; then
912
- flags_only=false
913
- break
914
- fi
915
- done
916
- if ${flags_only}; then
917
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
918
- comp_list+=("  ")
919
- fi
920
- fi
921
-
922
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
923
- }
924
-
925
- # Completion for subcommand: "completion".
926
- function __murano-completion () {
927
- local subcmd1="$1"
928
- local subcmd2="$2"
929
- #local subcmdn="$3"
930
- local used_switches="${@:3}"
931
- local last="${COMP_WORDS[COMP_CWORD]}"
932
- local len=$(($COMP_CWORD - 1))
933
-
934
- local -a more_switches
935
-
936
- local -a comp_list
937
-
938
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
939
- #>&2 echo "used_switches=$used_switches"
940
- #>&2 echo "more_switches=$more_switches"
941
-
942
- # NOTE: Not doing anything special for ${subcmd2}.
943
- # Are there sub-sub-commands we shoud list?
944
-
945
- # Add unused application-wide flags.
946
- local idx
947
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
948
- local switch=${__app_switches[$idx]}
949
- if ! contains_element "$switch" "${used_switches[@]}"; then
950
- comp_list+=("$switch")
951
- fi
952
- done
953
- # Add unused subcommand flags.
954
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
955
- local switch=${more_switches[$idx]}
956
- comp_list+=("$switch")
957
- done
958
-
959
- # If there are only --flags, <TAB> will put the common prefix,
960
- # "--", but maybe the user doesn't want to add a flag after all.
961
- if [[ -z ${last} ]]; then
962
- local flags_only=true
963
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
964
- local switch=${comp_list[$idx]}
965
- if [[ ${switch} != --* ]]; then
966
- flags_only=false
967
- break
968
- fi
969
- done
970
- if ${flags_only}; then
971
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
972
- comp_list+=("  ")
973
- fi
974
- fi
975
-
976
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
977
- }
978
-
979
- # Completion for subcommand: "config".
980
- function __murano-config () {
981
- local subcmd1="$1"
982
- local subcmd2="$2"
983
- #local subcmdn="$3"
984
- local used_switches="${@:3}"
985
- local last="${COMP_WORDS[COMP_CWORD]}"
986
- local len=$(($COMP_CWORD - 1))
987
-
988
- local -a more_switches
989
-
990
- local -a comp_list
991
-
992
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
993
- #>&2 echo "used_switches=$used_switches"
994
- #>&2 echo "more_switches=$more_switches"
995
-
996
- # NOTE: Not doing anything special for ${subcmd2}.
997
- # Are there sub-sub-commands we shoud list?
998
-
999
- # Add unused application-wide flags.
1000
- local idx
1001
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
1002
- local switch=${__app_switches[$idx]}
1003
- if ! contains_element "$switch" "${used_switches[@]}"; then
1004
- comp_list+=("$switch")
1005
- fi
1006
- done
1007
- # Add unused subcommand flags.
1008
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
1009
- local switch=${more_switches[$idx]}
1010
- comp_list+=("$switch")
1011
- done
1012
-
1013
- # If there are only --flags, <TAB> will put the common prefix,
1014
- # "--", but maybe the user doesn't want to add a flag after all.
1015
- if [[ -z ${last} ]]; then
1016
- local flags_only=true
1017
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
1018
- local switch=${comp_list[$idx]}
1019
- if [[ ${switch} != --* ]]; then
1020
- flags_only=false
1021
- break
1022
- fi
1023
- done
1024
- if ${flags_only}; then
1025
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
1026
- comp_list+=("  ")
1027
- fi
1028
- fi
1029
-
1030
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
1031
- }
1032
-
1033
- # Completion for subcommand: "content".
1034
- function __murano-content () {
1035
- local subcmd1="$1"
1036
- local subcmd2="$2"
1037
- #local subcmdn="$3"
1038
- local used_switches="${@:3}"
1039
- local last="${COMP_WORDS[COMP_CWORD]}"
1040
- local len=$(($COMP_CWORD - 1))
1041
-
1042
- local -a more_switches
1043
-
1044
- local -a comp_list
1045
-
1046
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
1047
- #>&2 echo "used_switches=$used_switches"
1048
- #>&2 echo "more_switches=$more_switches"
1049
-
1050
- # NOTE: Not doing anything special for ${subcmd2}.
1051
- # Are there sub-sub-commands we shoud list?
1052
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
1053
- comp_list=(
1054
- delete
1055
- download
1056
- info
1057
- list
1058
- upload
1059
- )
1060
- else
1061
- case $subcmd1 in
1062
- (delete)
1063
- more_switches=(
1064
- {--trace}
1065
- )
1066
- ;;
1067
- (download)
1068
- more_switches=(
1069
- {--trace}
1070
- )
1071
- ;;
1072
- (info)
1073
- more_switches=(
1074
- )
1075
- ;;
1076
- (list)
1077
- more_switches=(
1078
- {--trace}
1079
- )
1080
- ;;
1081
- (upload)
1082
- more_switches=(
1083
- {--trace}
1084
- )
1085
- ;;
1086
- esac
1087
- fi
1088
-
1089
- # Add unused application-wide flags.
1090
- local idx
1091
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
1092
- local switch=${__app_switches[$idx]}
1093
- if ! contains_element "$switch" "${used_switches[@]}"; then
1094
- comp_list+=("$switch")
1095
- fi
1096
- done
1097
- # Add unused subcommand flags.
1098
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
1099
- local switch=${more_switches[$idx]}
1100
- comp_list+=("$switch")
1101
- done
1102
-
1103
- # If there are only --flags, <TAB> will put the common prefix,
1104
- # "--", but maybe the user doesn't want to add a flag after all.
1105
- if [[ -z ${last} ]]; then
1106
- local flags_only=true
1107
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
1108
- local switch=${comp_list[$idx]}
1109
- if [[ ${switch} != --* ]]; then
1110
- flags_only=false
1111
- break
1112
- fi
1113
- done
1114
- if ${flags_only}; then
1115
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
1116
- comp_list+=("  ")
1117
- fi
1118
- fi
1119
-
1120
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
1121
- }
1122
-
1123
- # Completion for subcommand: "cors".
1124
- function __murano-cors () {
1125
- local subcmd1="$1"
1126
- local subcmd2="$2"
1127
- #local subcmdn="$3"
1128
- local used_switches="${@:3}"
1129
- local last="${COMP_WORDS[COMP_CWORD]}"
1130
- local len=$(($COMP_CWORD - 1))
1131
-
1132
- local -a more_switches
1133
-
1134
- local -a comp_list
1135
-
1136
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
1137
- #>&2 echo "used_switches=$used_switches"
1138
- #>&2 echo "more_switches=$more_switches"
1139
-
1140
- # NOTE: Not doing anything special for ${subcmd2}.
1141
- # Are there sub-sub-commands we shoud list?
1142
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
1143
- comp_list=(
1144
- set
1145
- )
1146
- else
1147
- case $subcmd1 in
1148
- (set)
1149
- more_switches=(
1150
- )
1151
- ;;
1152
- esac
1153
- fi
1154
-
1155
- # Add unused application-wide flags.
1156
- local idx
1157
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
1158
- local switch=${__app_switches[$idx]}
1159
- if ! contains_element "$switch" "${used_switches[@]}"; then
1160
- comp_list+=("$switch")
1161
- fi
1162
- done
1163
- # Add unused subcommand flags.
1164
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
1165
- local switch=${more_switches[$idx]}
1166
- comp_list+=("$switch")
1167
- done
1168
-
1169
- # If there are only --flags, <TAB> will put the common prefix,
1170
- # "--", but maybe the user doesn't want to add a flag after all.
1171
- if [[ -z ${last} ]]; then
1172
- local flags_only=true
1173
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
1174
- local switch=${comp_list[$idx]}
1175
- if [[ ${switch} != --* ]]; then
1176
- flags_only=false
1177
- break
1178
- fi
1179
- done
1180
- if ${flags_only}; then
1181
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
1182
- comp_list+=("  ")
1183
- fi
1184
- fi
1185
-
1186
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
1187
- }
1188
-
1189
- # Completion for subcommand: "create".
1190
- function __murano-create () {
1191
- local subcmd1="$1"
1192
- local subcmd2="$2"
1193
- #local subcmdn="$3"
1194
- local used_switches="${@:3}"
1195
- local last="${COMP_WORDS[COMP_CWORD]}"
1196
- local len=$(($COMP_CWORD - 1))
1197
-
1198
- local -a more_switches
1199
-
1200
- local -a comp_list
1201
-
1202
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
1203
- #>&2 echo "used_switches=$used_switches"
1204
- #>&2 echo "more_switches=$more_switches"
1205
-
1206
- # NOTE: Not doing anything special for ${subcmd2}.
1207
- # Are there sub-sub-commands we shoud list?
1208
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
1209
- comp_list=(
1210
- application
1211
- product
1212
- )
1213
- else
1214
- case $subcmd1 in
1215
- (application)
1216
- more_switches=(
1217
- {--trace}
1218
- )
1219
- ;;
1220
- (product)
1221
- more_switches=(
1222
- {--trace}
1223
- )
1224
- ;;
1225
- esac
1226
- fi
1227
-
1228
- # Add unused application-wide flags.
1229
- local idx
1230
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
1231
- local switch=${__app_switches[$idx]}
1232
- if ! contains_element "$switch" "${used_switches[@]}"; then
1233
- comp_list+=("$switch")
1234
- fi
1235
- done
1236
- # Add unused subcommand flags.
1237
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
1238
- local switch=${more_switches[$idx]}
1239
- comp_list+=("$switch")
1240
- done
1241
-
1242
- # If there are only --flags, <TAB> will put the common prefix,
1243
- # "--", but maybe the user doesn't want to add a flag after all.
1244
- if [[ -z ${last} ]]; then
1245
- local flags_only=true
1246
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
1247
- local switch=${comp_list[$idx]}
1248
- if [[ ${switch} != --* ]]; then
1249
- flags_only=false
1250
- break
1251
- fi
1252
- done
1253
- if ${flags_only}; then
1254
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
1255
- comp_list+=("  ")
1256
- fi
1257
- fi
1258
-
1259
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
1260
- }
1261
-
1262
- # Completion for subcommand: "delete".
1263
- function __murano-delete () {
1264
- local subcmd1="$1"
1265
- local subcmd2="$2"
1266
- #local subcmdn="$3"
1267
- local used_switches="${@:3}"
1268
- local last="${COMP_WORDS[COMP_CWORD]}"
1269
- local len=$(($COMP_CWORD - 1))
1270
-
1271
- local -a more_switches
1272
-
1273
- local -a comp_list
1274
-
1275
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
1276
- #>&2 echo "used_switches=$used_switches"
1277
- #>&2 echo "more_switches=$more_switches"
1278
-
1279
- # NOTE: Not doing anything special for ${subcmd2}.
1280
- # Are there sub-sub-commands we shoud list?
1281
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
1282
- comp_list=(
1283
- application
1284
- product
1285
- )
1286
- else
1287
- case $subcmd1 in
1288
- (application)
1289
- more_switches=(
1290
- {--trace}
1291
- )
1292
- ;;
1293
- (product)
1294
- more_switches=(
1295
- {--trace}
1296
- )
1297
- ;;
1298
- esac
1299
- fi
1300
-
1301
- # Add unused application-wide flags.
1302
- local idx
1303
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
1304
- local switch=${__app_switches[$idx]}
1305
- if ! contains_element "$switch" "${used_switches[@]}"; then
1306
- comp_list+=("$switch")
1307
- fi
1308
- done
1309
- # Add unused subcommand flags.
1310
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
1311
- local switch=${more_switches[$idx]}
1312
- comp_list+=("$switch")
1313
- done
1314
-
1315
- # If there are only --flags, <TAB> will put the common prefix,
1316
- # "--", but maybe the user doesn't want to add a flag after all.
1317
- if [[ -z ${last} ]]; then
1318
- local flags_only=true
1319
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
1320
- local switch=${comp_list[$idx]}
1321
- if [[ ${switch} != --* ]]; then
1322
- flags_only=false
1323
- break
1324
- fi
1325
- done
1326
- if ${flags_only}; then
1327
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
1328
- comp_list+=("  ")
1329
- fi
1330
- fi
1331
-
1332
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
1333
- }
1334
-
1335
- # Completion for subcommand: "device".
1336
- function __murano-device () {
1337
- local subcmd1="$1"
1338
- local subcmd2="$2"
1339
- #local subcmdn="$3"
1340
- local used_switches="${@:3}"
1341
- local last="${COMP_WORDS[COMP_CWORD]}"
1342
- local len=$(($COMP_CWORD - 1))
1343
-
1344
- local -a more_switches
1345
-
1346
- local -a comp_list
1347
-
1348
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
1349
- #>&2 echo "used_switches=$used_switches"
1350
- #>&2 echo "more_switches=$more_switches"
1351
-
1352
- # NOTE: Not doing anything special for ${subcmd2}.
1353
- # Are there sub-sub-commands we shoud list?
1354
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
1355
- comp_list=(
1356
- activate
1357
- delete
1358
- enable
1359
- httpurl
1360
- list
1361
- lock
1362
- read
1363
- revoke
1364
- unlock
1365
- write
1366
- )
1367
- else
1368
- case $subcmd1 in
1369
- (activate)
1370
- more_switches=(
1371
- )
1372
- ;;
1373
- (delete)
1374
- more_switches=(
1375
- )
1376
- ;;
1377
- (enable)
1378
- more_switches=(
1379
- {--trace}
1380
- )
1381
- ;;
1382
- (httpurl)
1383
- more_switches=(
1384
- )
1385
- ;;
1386
- (list)
1387
- more_switches=(
1388
- {--trace}
1389
- )
1390
- ;;
1391
- (lock)
1392
- more_switches=(
1393
- )
1394
- ;;
1395
- (read)
1396
- more_switches=(
1397
- {--trace}
1398
- )
1399
- ;;
1400
- (revoke)
1401
- more_switches=(
1402
- )
1403
- ;;
1404
- (unlock)
1405
- more_switches=(
1406
- )
1407
- ;;
1408
- (write)
1409
- more_switches=(
1410
- )
1411
- ;;
1412
- esac
1413
- fi
1414
-
1415
- # Add unused application-wide flags.
1416
- local idx
1417
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
1418
- local switch=${__app_switches[$idx]}
1419
- if ! contains_element "$switch" "${used_switches[@]}"; then
1420
- comp_list+=("$switch")
1421
- fi
1422
- done
1423
- # Add unused subcommand flags.
1424
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
1425
- local switch=${more_switches[$idx]}
1426
- comp_list+=("$switch")
1427
- done
1428
-
1429
- # If there are only --flags, <TAB> will put the common prefix,
1430
- # "--", but maybe the user doesn't want to add a flag after all.
1431
- if [[ -z ${last} ]]; then
1432
- local flags_only=true
1433
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
1434
- local switch=${comp_list[$idx]}
1435
- if [[ ${switch} != --* ]]; then
1436
- flags_only=false
1437
- break
1438
- fi
1439
- done
1440
- if ${flags_only}; then
1441
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
1442
- comp_list+=("  ")
1443
- fi
1444
- fi
1445
-
1446
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
1447
- }
1448
-
1449
- # Completion for subcommand: "devices".
1450
- function __murano-devices () {
1451
- local subcmd1="$1"
1452
- local subcmd2="$2"
1453
- #local subcmdn="$3"
1454
- local used_switches="${@:3}"
1455
- local last="${COMP_WORDS[COMP_CWORD]}"
1456
- local len=$(($COMP_CWORD - 1))
1457
-
1458
- local -a more_switches
1459
-
1460
- local -a comp_list
1461
-
1462
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
1463
- #>&2 echo "used_switches=$used_switches"
1464
- #>&2 echo "more_switches=$more_switches"
1465
-
1466
- # NOTE: Not doing anything special for ${subcmd2}.
1467
- # Are there sub-sub-commands we shoud list?
1468
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
1469
- comp_list=(
1470
- list
1471
- )
1472
- else
1473
- case $subcmd1 in
1474
- (list)
1475
- more_switches=(
1476
- {--trace}
1477
- )
1478
- ;;
1479
- esac
1480
- fi
1481
-
1482
- # Add unused application-wide flags.
1483
- local idx
1484
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
1485
- local switch=${__app_switches[$idx]}
1486
- if ! contains_element "$switch" "${used_switches[@]}"; then
1487
- comp_list+=("$switch")
1488
- fi
1489
- done
1490
- # Add unused subcommand flags.
1491
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
1492
- local switch=${more_switches[$idx]}
1493
- comp_list+=("$switch")
1494
- done
1495
-
1496
- # If there are only --flags, <TAB> will put the common prefix,
1497
- # "--", but maybe the user doesn't want to add a flag after all.
1498
- if [[ -z ${last} ]]; then
1499
- local flags_only=true
1500
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
1501
- local switch=${comp_list[$idx]}
1502
- if [[ ${switch} != --* ]]; then
1503
- flags_only=false
1504
- break
1505
- fi
1506
- done
1507
- if ${flags_only}; then
1508
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
1509
- comp_list+=("  ")
1510
- fi
1511
- fi
1512
-
1513
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
1514
- }
1515
-
1516
- # Completion for subcommand: "diff".
1517
- function __murano-diff () {
1518
- local subcmd1="$1"
1519
- local subcmd2="$2"
1520
- #local subcmdn="$3"
1521
- local used_switches="${@:3}"
1522
- local last="${COMP_WORDS[COMP_CWORD]}"
1523
- local len=$(($COMP_CWORD - 1))
1524
-
1525
- local -a more_switches
1526
-
1527
- local -a comp_list
1528
-
1529
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
1530
- #>&2 echo "used_switches=$used_switches"
1531
- #>&2 echo "more_switches=$more_switches"
1532
-
1533
- # NOTE: Not doing anything special for ${subcmd2}.
1534
- # Are there sub-sub-commands we shoud list?
1535
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
1536
- comp_list=(
1537
- application
1538
- product
1539
- )
1540
- else
1541
- case $subcmd1 in
1542
- (application)
1543
- more_switches=(
1544
- {--trace}
1545
- )
1546
- ;;
1547
- (product)
1548
- more_switches=(
1549
- {--trace}
1550
- )
1551
- ;;
1552
- esac
1553
- fi
1554
-
1555
- # Add unused application-wide flags.
1556
- local idx
1557
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
1558
- local switch=${__app_switches[$idx]}
1559
- if ! contains_element "$switch" "${used_switches[@]}"; then
1560
- comp_list+=("$switch")
1561
- fi
1562
- done
1563
- # Add unused subcommand flags.
1564
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
1565
- local switch=${more_switches[$idx]}
1566
- comp_list+=("$switch")
1567
- done
1568
-
1569
- # If there are only --flags, <TAB> will put the common prefix,
1570
- # "--", but maybe the user doesn't want to add a flag after all.
1571
- if [[ -z ${last} ]]; then
1572
- local flags_only=true
1573
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
1574
- local switch=${comp_list[$idx]}
1575
- if [[ ${switch} != --* ]]; then
1576
- flags_only=false
1577
- break
1578
- fi
1579
- done
1580
- if ${flags_only}; then
1581
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
1582
- comp_list+=("  ")
1583
- fi
1584
- fi
1585
-
1586
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
1587
- }
1588
-
1589
- # Completion for subcommand: "domain".
1590
- function __murano-domain () {
1591
- local subcmd1="$1"
1592
- local subcmd2="$2"
1593
- #local subcmdn="$3"
1594
- local used_switches="${@:3}"
1595
- local last="${COMP_WORDS[COMP_CWORD]}"
1596
- local len=$(($COMP_CWORD - 1))
1597
-
1598
- local -a more_switches
1599
-
1600
- local -a comp_list
1601
-
1602
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
1603
- #>&2 echo "used_switches=$used_switches"
1604
- #>&2 echo "more_switches=$more_switches"
1605
-
1606
- # NOTE: Not doing anything special for ${subcmd2}.
1607
- # Are there sub-sub-commands we shoud list?
1608
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
1609
- comp_list=(
1610
- application
1611
- product
1612
- )
1613
- else
1614
- case $subcmd1 in
1615
- (application)
1616
- more_switches=(
1617
- {--trace}
1618
- )
1619
- ;;
1620
- (product)
1621
- more_switches=(
1622
- {--trace}
1623
- )
1624
- ;;
1625
- esac
1626
- fi
1627
-
1628
- # Add unused application-wide flags.
1629
- local idx
1630
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
1631
- local switch=${__app_switches[$idx]}
1632
- if ! contains_element "$switch" "${used_switches[@]}"; then
1633
- comp_list+=("$switch")
1634
- fi
1635
- done
1636
- # Add unused subcommand flags.
1637
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
1638
- local switch=${more_switches[$idx]}
1639
- comp_list+=("$switch")
1640
- done
1641
-
1642
- # If there are only --flags, <TAB> will put the common prefix,
1643
- # "--", but maybe the user doesn't want to add a flag after all.
1644
- if [[ -z ${last} ]]; then
1645
- local flags_only=true
1646
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
1647
- local switch=${comp_list[$idx]}
1648
- if [[ ${switch} != --* ]]; then
1649
- flags_only=false
1650
- break
1651
- fi
1652
- done
1653
- if ${flags_only}; then
1654
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
1655
- comp_list+=("  ")
1656
- fi
1657
- fi
1658
-
1659
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
1660
- }
1661
-
1662
- # Completion for subcommand: "element".
1663
- function __murano-element () {
1664
- local subcmd1="$1"
1665
- local subcmd2="$2"
1666
- #local subcmdn="$3"
1667
- local used_switches="${@:3}"
1668
- local last="${COMP_WORDS[COMP_CWORD]}"
1669
- local len=$(($COMP_CWORD - 1))
1670
-
1671
- local -a more_switches
1672
-
1673
- local -a comp_list
1674
-
1675
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
1676
- #>&2 echo "used_switches=$used_switches"
1677
- #>&2 echo "more_switches=$more_switches"
1678
-
1679
- # NOTE: Not doing anything special for ${subcmd2}.
1680
- # Are there sub-sub-commands we shoud list?
1681
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
1682
- comp_list=(
1683
- edit
1684
- show
1685
- update
1686
- )
1687
- else
1688
- case $subcmd1 in
1689
- (edit)
1690
- more_switches=(
1691
- {--trace}
1692
- )
1693
- ;;
1694
- (show)
1695
- more_switches=(
1696
- {--trace}
1697
- )
1698
- ;;
1699
- (update)
1700
- more_switches=(
1701
- {--trace}
1702
- )
1703
- ;;
1704
- esac
1705
- fi
1706
-
1707
- # Add unused application-wide flags.
1708
- local idx
1709
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
1710
- local switch=${__app_switches[$idx]}
1711
- if ! contains_element "$switch" "${used_switches[@]}"; then
1712
- comp_list+=("$switch")
1713
- fi
1714
- done
1715
- # Add unused subcommand flags.
1716
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
1717
- local switch=${more_switches[$idx]}
1718
- comp_list+=("$switch")
1719
- done
1720
-
1721
- # If there are only --flags, <TAB> will put the common prefix,
1722
- # "--", but maybe the user doesn't want to add a flag after all.
1723
- if [[ -z ${last} ]]; then
1724
- local flags_only=true
1725
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
1726
- local switch=${comp_list[$idx]}
1727
- if [[ ${switch} != --* ]]; then
1728
- flags_only=false
1729
- break
1730
- fi
1731
- done
1732
- if ${flags_only}; then
1733
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
1734
- comp_list+=("  ")
1735
- fi
1736
- fi
1737
-
1738
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
1739
- }
1740
-
1741
- # Completion for subcommand: "exchange".
1742
- function __murano-exchange () {
1743
- local subcmd1="$1"
1744
- local subcmd2="$2"
1745
- #local subcmdn="$3"
1746
- local used_switches="${@:3}"
1747
- local last="${COMP_WORDS[COMP_CWORD]}"
1748
- local len=$(($COMP_CWORD - 1))
1749
-
1750
- local -a more_switches
1751
-
1752
- local -a comp_list
1753
-
1754
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
1755
- #>&2 echo "used_switches=$used_switches"
1756
- #>&2 echo "more_switches=$more_switches"
1757
-
1758
- # NOTE: Not doing anything special for ${subcmd2}.
1759
- # Are there sub-sub-commands we shoud list?
1760
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
1761
- comp_list=(
1762
- add
1763
- buy
1764
- list
1765
- purchase
1766
- )
1767
- else
1768
- case $subcmd1 in
1769
- (add)
1770
- more_switches=(
1771
- {--trace}
1772
- )
1773
- ;;
1774
- (buy)
1775
- more_switches=(
1776
- {--trace}
1777
- )
1778
- ;;
1779
- (list)
1780
- more_switches=(
1781
- {--trace}
1782
- )
1783
- ;;
1784
- (purchase)
1785
- more_switches=(
1786
- {--trace}
1787
- )
1788
- ;;
1789
- esac
1790
- fi
1791
-
1792
- # Add unused application-wide flags.
1793
- local idx
1794
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
1795
- local switch=${__app_switches[$idx]}
1796
- if ! contains_element "$switch" "${used_switches[@]}"; then
1797
- comp_list+=("$switch")
1798
- fi
1799
- done
1800
- # Add unused subcommand flags.
1801
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
1802
- local switch=${more_switches[$idx]}
1803
- comp_list+=("$switch")
1804
- done
1805
-
1806
- # If there are only --flags, <TAB> will put the common prefix,
1807
- # "--", but maybe the user doesn't want to add a flag after all.
1808
- if [[ -z ${last} ]]; then
1809
- local flags_only=true
1810
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
1811
- local switch=${comp_list[$idx]}
1812
- if [[ ${switch} != --* ]]; then
1813
- flags_only=false
1814
- break
1815
- fi
1816
- done
1817
- if ${flags_only}; then
1818
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
1819
- comp_list+=("  ")
1820
- fi
1821
- fi
1822
-
1823
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
1824
- }
1825
-
1826
- # Completion for subcommand: "find".
1827
- function __murano-find () {
1828
- local subcmd1="$1"
1829
- local subcmd2="$2"
1830
- #local subcmdn="$3"
1831
- local used_switches="${@:3}"
1832
- local last="${COMP_WORDS[COMP_CWORD]}"
1833
- local len=$(($COMP_CWORD - 1))
1834
-
1835
- local -a more_switches
1836
-
1837
- local -a comp_list
1838
-
1839
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
1840
- #>&2 echo "used_switches=$used_switches"
1841
- #>&2 echo "more_switches=$more_switches"
1842
-
1843
- # NOTE: Not doing anything special for ${subcmd2}.
1844
- # Are there sub-sub-commands we shoud list?
1845
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
1846
- comp_list=(
1847
- application
1848
- product
1849
- )
1850
- else
1851
- case $subcmd1 in
1852
- (application)
1853
- more_switches=(
1854
- {--trace}
1855
- )
1856
- ;;
1857
- (product)
1858
- more_switches=(
1859
- {--trace}
1860
- )
1861
- ;;
1862
- esac
1863
- fi
1864
-
1865
- # Add unused application-wide flags.
1866
- local idx
1867
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
1868
- local switch=${__app_switches[$idx]}
1869
- if ! contains_element "$switch" "${used_switches[@]}"; then
1870
- comp_list+=("$switch")
1871
- fi
1872
- done
1873
- # Add unused subcommand flags.
1874
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
1875
- local switch=${more_switches[$idx]}
1876
- comp_list+=("$switch")
1877
- done
1878
-
1879
- # If there are only --flags, <TAB> will put the common prefix,
1880
- # "--", but maybe the user doesn't want to add a flag after all.
1881
- if [[ -z ${last} ]]; then
1882
- local flags_only=true
1883
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
1884
- local switch=${comp_list[$idx]}
1885
- if [[ ${switch} != --* ]]; then
1886
- flags_only=false
1887
- break
1888
- fi
1889
- done
1890
- if ${flags_only}; then
1891
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
1892
- comp_list+=("  ")
1893
- fi
1894
- fi
1895
-
1896
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
1897
- }
1898
-
1899
- # Completion for subcommand: "help".
1900
- function __murano-help () {
1901
- local subcmd1="$1"
1902
- local subcmd2="$2"
1903
- #local subcmdn="$3"
1904
- local used_switches="${@:3}"
1905
- local last="${COMP_WORDS[COMP_CWORD]}"
1906
- local len=$(($COMP_CWORD - 1))
1907
-
1908
- local -a more_switches
1909
-
1910
- local -a comp_list
1911
-
1912
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
1913
- #>&2 echo "used_switches=$used_switches"
1914
- #>&2 echo "more_switches=$more_switches"
1915
-
1916
- # NOTE: Not doing anything special for ${subcmd2}.
1917
- # Are there sub-sub-commands we shoud list?
1918
-
1919
- # Add unused application-wide flags.
1920
- local idx
1921
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
1922
- local switch=${__app_switches[$idx]}
1923
- if ! contains_element "$switch" "${used_switches[@]}"; then
1924
- comp_list+=("$switch")
1925
- fi
1926
- done
1927
- # Add unused subcommand flags.
1928
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
1929
- local switch=${more_switches[$idx]}
1930
- comp_list+=("$switch")
1931
- done
1932
-
1933
- # If there are only --flags, <TAB> will put the common prefix,
1934
- # "--", but maybe the user doesn't want to add a flag after all.
1935
- if [[ -z ${last} ]]; then
1936
- local flags_only=true
1937
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
1938
- local switch=${comp_list[$idx]}
1939
- if [[ ${switch} != --* ]]; then
1940
- flags_only=false
1941
- break
1942
- fi
1943
- done
1944
- if ${flags_only}; then
1945
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
1946
- comp_list+=("  ")
1947
- fi
1948
- fi
1949
-
1950
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
1951
- }
1952
-
1953
- # Completion for subcommand: "init".
1954
- function __murano-init () {
1955
- local subcmd1="$1"
1956
- local subcmd2="$2"
1957
- #local subcmdn="$3"
1958
- local used_switches="${@:3}"
1959
- local last="${COMP_WORDS[COMP_CWORD]}"
1960
- local len=$(($COMP_CWORD - 1))
1961
-
1962
- local -a more_switches
1963
-
1964
- local -a comp_list
1965
-
1966
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
1967
- #>&2 echo "used_switches=$used_switches"
1968
- #>&2 echo "more_switches=$more_switches"
1969
-
1970
- # NOTE: Not doing anything special for ${subcmd2}.
1971
- # Are there sub-sub-commands we shoud list?
1972
-
1973
- # Add unused application-wide flags.
1974
- local idx
1975
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
1976
- local switch=${__app_switches[$idx]}
1977
- if ! contains_element "$switch" "${used_switches[@]}"; then
1978
- comp_list+=("$switch")
1979
- fi
1980
- done
1981
- # Add unused subcommand flags.
1982
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
1983
- local switch=${more_switches[$idx]}
1984
- comp_list+=("$switch")
1985
- done
1986
-
1987
- # If there are only --flags, <TAB> will put the common prefix,
1988
- # "--", but maybe the user doesn't want to add a flag after all.
1989
- if [[ -z ${last} ]]; then
1990
- local flags_only=true
1991
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
1992
- local switch=${comp_list[$idx]}
1993
- if [[ ${switch} != --* ]]; then
1994
- flags_only=false
1995
- break
1996
- fi
1997
- done
1998
- if ${flags_only}; then
1999
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
2000
- comp_list+=("  ")
2001
- fi
2002
- fi
2003
-
2004
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
2005
- }
2006
-
2007
- # Completion for subcommand: "keystore".
2008
- function __murano-keystore () {
2009
- local subcmd1="$1"
2010
- local subcmd2="$2"
2011
- #local subcmdn="$3"
2012
- local used_switches="${@:3}"
2013
- local last="${COMP_WORDS[COMP_CWORD]}"
2014
- local len=$(($COMP_CWORD - 1))
2015
-
2016
- local -a more_switches
2017
-
2018
- local -a comp_list
2019
-
2020
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
2021
- #>&2 echo "used_switches=$used_switches"
2022
- #>&2 echo "more_switches=$more_switches"
2023
-
2024
- # NOTE: Not doing anything special for ${subcmd2}.
2025
- # Are there sub-sub-commands we shoud list?
2026
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
2027
- comp_list=(
2028
- clearAll
2029
- cmd
2030
- command
2031
- del
2032
- delete
2033
- get
2034
- info
2035
- lindex
2036
- linsert
2037
- list
2038
- llen
2039
- lpush
2040
- lrange
2041
- lrem
2042
- lset
2043
- ltrim
2044
- rm
2045
- rpop
2046
- rpush
2047
- sadd
2048
- scard
2049
- set
2050
- smembers
2051
- spop
2052
- srem
2053
- )
2054
- else
2055
- case $subcmd1 in
2056
- (clearAll)
2057
- more_switches=(
2058
- )
2059
- ;;
2060
- (cmd)
2061
- more_switches=(
2062
- )
2063
- ;;
2064
- (command)
2065
- more_switches=(
2066
- )
2067
- ;;
2068
- (del)
2069
- more_switches=(
2070
- )
2071
- ;;
2072
- (delete)
2073
- more_switches=(
2074
- )
2075
- ;;
2076
- (get)
2077
- more_switches=(
2078
- )
2079
- ;;
2080
- (info)
2081
- more_switches=(
2082
- )
2083
- ;;
2084
- (lindex)
2085
- more_switches=(
2086
- )
2087
- ;;
2088
- (linsert)
2089
- more_switches=(
2090
- )
2091
- ;;
2092
- (list)
2093
- more_switches=(
2094
- )
2095
- ;;
2096
- (llen)
2097
- more_switches=(
2098
- )
2099
- ;;
2100
- (lpush)
2101
- more_switches=(
2102
- )
2103
- ;;
2104
- (lrange)
2105
- more_switches=(
2106
- )
2107
- ;;
2108
- (lrem)
2109
- more_switches=(
2110
- )
2111
- ;;
2112
- (lset)
2113
- more_switches=(
2114
- )
2115
- ;;
2116
- (ltrim)
2117
- more_switches=(
2118
- )
2119
- ;;
2120
- (rm)
2121
- more_switches=(
2122
- )
2123
- ;;
2124
- (rpop)
2125
- more_switches=(
2126
- )
2127
- ;;
2128
- (rpush)
2129
- more_switches=(
2130
- )
2131
- ;;
2132
- (sadd)
2133
- more_switches=(
2134
- )
2135
- ;;
2136
- (scard)
2137
- more_switches=(
2138
- )
2139
- ;;
2140
- (set)
2141
- more_switches=(
2142
- )
2143
- ;;
2144
- (smembers)
2145
- more_switches=(
2146
- )
2147
- ;;
2148
- (spop)
2149
- more_switches=(
2150
- )
2151
- ;;
2152
- (srem)
2153
- more_switches=(
2154
- )
2155
- ;;
2156
- esac
2157
- fi
2158
-
2159
- # Add unused application-wide flags.
2160
- local idx
2161
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
2162
- local switch=${__app_switches[$idx]}
2163
- if ! contains_element "$switch" "${used_switches[@]}"; then
2164
- comp_list+=("$switch")
2165
- fi
2166
- done
2167
- # Add unused subcommand flags.
2168
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
2169
- local switch=${more_switches[$idx]}
2170
- comp_list+=("$switch")
2171
- done
2172
-
2173
- # If there are only --flags, <TAB> will put the common prefix,
2174
- # "--", but maybe the user doesn't want to add a flag after all.
2175
- if [[ -z ${last} ]]; then
2176
- local flags_only=true
2177
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
2178
- local switch=${comp_list[$idx]}
2179
- if [[ ${switch} != --* ]]; then
2180
- flags_only=false
2181
- break
2182
- fi
2183
- done
2184
- if ${flags_only}; then
2185
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
2186
- comp_list+=("  ")
2187
- fi
2188
- fi
2189
-
2190
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
2191
- }
2192
-
2193
- # Completion for subcommand: "link".
2194
- function __murano-link () {
2195
- local subcmd1="$1"
2196
- local subcmd2="$2"
2197
- #local subcmdn="$3"
2198
- local used_switches="${@:3}"
2199
- local last="${COMP_WORDS[COMP_CWORD]}"
2200
- local len=$(($COMP_CWORD - 1))
2201
-
2202
- local -a more_switches
2203
-
2204
- local -a comp_list
2205
-
2206
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
2207
- #>&2 echo "used_switches=$used_switches"
2208
- #>&2 echo "more_switches=$more_switches"
2209
-
2210
- # NOTE: Not doing anything special for ${subcmd2}.
2211
- # Are there sub-sub-commands we shoud list?
2212
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
2213
- comp_list=(
2214
- list
2215
- set
2216
- unset
2217
- )
2218
- else
2219
- case $subcmd1 in
2220
- (list)
2221
- more_switches=(
2222
- {--trace}
2223
- )
2224
- ;;
2225
- (set)
2226
- more_switches=(
2227
- {--trace}
2228
- )
2229
- ;;
2230
- (unset)
2231
- more_switches=(
2232
- {--trace}
2233
- )
2234
- ;;
2235
- esac
2236
- fi
2237
-
2238
- # Add unused application-wide flags.
2239
- local idx
2240
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
2241
- local switch=${__app_switches[$idx]}
2242
- if ! contains_element "$switch" "${used_switches[@]}"; then
2243
- comp_list+=("$switch")
2244
- fi
2245
- done
2246
- # Add unused subcommand flags.
2247
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
2248
- local switch=${more_switches[$idx]}
2249
- comp_list+=("$switch")
2250
- done
2251
-
2252
- # If there are only --flags, <TAB> will put the common prefix,
2253
- # "--", but maybe the user doesn't want to add a flag after all.
2254
- if [[ -z ${last} ]]; then
2255
- local flags_only=true
2256
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
2257
- local switch=${comp_list[$idx]}
2258
- if [[ ${switch} != --* ]]; then
2259
- flags_only=false
2260
- break
2261
- fi
2262
- done
2263
- if ${flags_only}; then
2264
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
2265
- comp_list+=("  ")
2266
- fi
2267
- fi
2268
-
2269
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
2270
- }
2271
-
2272
- # Completion for subcommand: "links".
2273
- function __murano-links () {
2274
- local subcmd1="$1"
2275
- local subcmd2="$2"
2276
- #local subcmdn="$3"
2277
- local used_switches="${@:3}"
2278
- local last="${COMP_WORDS[COMP_CWORD]}"
2279
- local len=$(($COMP_CWORD - 1))
2280
-
2281
- local -a more_switches
2282
-
2283
- local -a comp_list
2284
-
2285
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
2286
- #>&2 echo "used_switches=$used_switches"
2287
- #>&2 echo "more_switches=$more_switches"
2288
-
2289
- # NOTE: Not doing anything special for ${subcmd2}.
2290
- # Are there sub-sub-commands we shoud list?
2291
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
2292
- comp_list=(
2293
- list
2294
- )
2295
- else
2296
- case $subcmd1 in
2297
- (list)
2298
- more_switches=(
2299
- {--trace}
2300
- )
2301
- ;;
2302
- esac
2303
- fi
2304
-
2305
- # Add unused application-wide flags.
2306
- local idx
2307
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
2308
- local switch=${__app_switches[$idx]}
2309
- if ! contains_element "$switch" "${used_switches[@]}"; then
2310
- comp_list+=("$switch")
2311
- fi
2312
- done
2313
- # Add unused subcommand flags.
2314
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
2315
- local switch=${more_switches[$idx]}
2316
- comp_list+=("$switch")
2317
- done
2318
-
2319
- # If there are only --flags, <TAB> will put the common prefix,
2320
- # "--", but maybe the user doesn't want to add a flag after all.
2321
- if [[ -z ${last} ]]; then
2322
- local flags_only=true
2323
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
2324
- local switch=${comp_list[$idx]}
2325
- if [[ ${switch} != --* ]]; then
2326
- flags_only=false
2327
- break
2328
- fi
2329
- done
2330
- if ${flags_only}; then
2331
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
2332
- comp_list+=("  ")
2333
- fi
2334
- fi
2335
-
2336
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
2337
- }
2338
-
2339
- # Completion for subcommand: "list".
2340
- function __murano-list () {
2341
- local subcmd1="$1"
2342
- local subcmd2="$2"
2343
- #local subcmdn="$3"
2344
- local used_switches="${@:3}"
2345
- local last="${COMP_WORDS[COMP_CWORD]}"
2346
- local len=$(($COMP_CWORD - 1))
2347
-
2348
- local -a more_switches
2349
-
2350
- local -a comp_list
2351
-
2352
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
2353
- #>&2 echo "used_switches=$used_switches"
2354
- #>&2 echo "more_switches=$more_switches"
2355
-
2356
- # NOTE: Not doing anything special for ${subcmd2}.
2357
- # Are there sub-sub-commands we shoud list?
2358
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
2359
- comp_list=(
2360
- application
2361
- applications
2362
- product
2363
- products
2364
- solutions
2365
- )
2366
- else
2367
- case $subcmd1 in
2368
- (application)
2369
- more_switches=(
2370
- {--trace}
2371
- )
2372
- ;;
2373
- (applications)
2374
- more_switches=(
2375
- {--trace}
2376
- )
2377
- ;;
2378
- (product)
2379
- more_switches=(
2380
- {--trace}
2381
- )
2382
- ;;
2383
- (products)
2384
- more_switches=(
2385
- {--trace}
2386
- )
2387
- ;;
2388
- (solutions)
2389
- more_switches=(
2390
- {--trace}
2391
- )
2392
- ;;
2393
- esac
2394
- fi
2395
-
2396
- # Add unused application-wide flags.
2397
- local idx
2398
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
2399
- local switch=${__app_switches[$idx]}
2400
- if ! contains_element "$switch" "${used_switches[@]}"; then
2401
- comp_list+=("$switch")
2402
- fi
2403
- done
2404
- # Add unused subcommand flags.
2405
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
2406
- local switch=${more_switches[$idx]}
2407
- comp_list+=("$switch")
2408
- done
2409
-
2410
- # If there are only --flags, <TAB> will put the common prefix,
2411
- # "--", but maybe the user doesn't want to add a flag after all.
2412
- if [[ -z ${last} ]]; then
2413
- local flags_only=true
2414
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
2415
- local switch=${comp_list[$idx]}
2416
- if [[ ${switch} != --* ]]; then
2417
- flags_only=false
2418
- break
2419
- fi
2420
- done
2421
- if ${flags_only}; then
2422
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
2423
- comp_list+=("  ")
2424
- fi
2425
- fi
2426
-
2427
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
2428
- }
2429
-
2430
- # Completion for subcommand: "login".
2431
- function __murano-login () {
2432
- local subcmd1="$1"
2433
- local subcmd2="$2"
2434
- #local subcmdn="$3"
2435
- local used_switches="${@:3}"
2436
- local last="${COMP_WORDS[COMP_CWORD]}"
2437
- local len=$(($COMP_CWORD - 1))
2438
-
2439
- local -a more_switches
2440
-
2441
- local -a comp_list
2442
-
2443
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
2444
- #>&2 echo "used_switches=$used_switches"
2445
- #>&2 echo "more_switches=$more_switches"
2446
-
2447
- # NOTE: Not doing anything special for ${subcmd2}.
2448
- # Are there sub-sub-commands we shoud list?
2449
-
2450
- # Add unused application-wide flags.
2451
- local idx
2452
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
2453
- local switch=${__app_switches[$idx]}
2454
- if ! contains_element "$switch" "${used_switches[@]}"; then
2455
- comp_list+=("$switch")
2456
- fi
2457
- done
2458
- # Add unused subcommand flags.
2459
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
2460
- local switch=${more_switches[$idx]}
2461
- comp_list+=("$switch")
2462
- done
2463
-
2464
- # If there are only --flags, <TAB> will put the common prefix,
2465
- # "--", but maybe the user doesn't want to add a flag after all.
2466
- if [[ -z ${last} ]]; then
2467
- local flags_only=true
2468
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
2469
- local switch=${comp_list[$idx]}
2470
- if [[ ${switch} != --* ]]; then
2471
- flags_only=false
2472
- break
2473
- fi
2474
- done
2475
- if ${flags_only}; then
2476
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
2477
- comp_list+=("  ")
2478
- fi
2479
- fi
2480
-
2481
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
2482
- }
2483
-
2484
- # Completion for subcommand: "logout".
2485
- function __murano-logout () {
2486
- local subcmd1="$1"
2487
- local subcmd2="$2"
2488
- #local subcmdn="$3"
2489
- local used_switches="${@:3}"
2490
- local last="${COMP_WORDS[COMP_CWORD]}"
2491
- local len=$(($COMP_CWORD - 1))
2492
-
2493
- local -a more_switches
2494
-
2495
- local -a comp_list
2496
-
2497
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
2498
- #>&2 echo "used_switches=$used_switches"
2499
- #>&2 echo "more_switches=$more_switches"
2500
-
2501
- # NOTE: Not doing anything special for ${subcmd2}.
2502
- # Are there sub-sub-commands we shoud list?
2503
-
2504
- # Add unused application-wide flags.
2505
- local idx
2506
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
2507
- local switch=${__app_switches[$idx]}
2508
- if ! contains_element "$switch" "${used_switches[@]}"; then
2509
- comp_list+=("$switch")
2510
- fi
2511
- done
2512
- # Add unused subcommand flags.
2513
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
2514
- local switch=${more_switches[$idx]}
2515
- comp_list+=("$switch")
2516
- done
2517
-
2518
- # If there are only --flags, <TAB> will put the common prefix,
2519
- # "--", but maybe the user doesn't want to add a flag after all.
2520
- if [[ -z ${last} ]]; then
2521
- local flags_only=true
2522
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
2523
- local switch=${comp_list[$idx]}
2524
- if [[ ${switch} != --* ]]; then
2525
- flags_only=false
2526
- break
2527
- fi
2528
- done
2529
- if ${flags_only}; then
2530
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
2531
- comp_list+=("  ")
2532
- fi
2533
- fi
2534
-
2535
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
2536
- }
2537
-
2538
- # Completion for subcommand: "logs".
2539
- function __murano-logs () {
2540
- local subcmd1="$1"
2541
- local subcmd2="$2"
2542
- #local subcmdn="$3"
2543
- local used_switches="${@:3}"
2544
- local last="${COMP_WORDS[COMP_CWORD]}"
2545
- local len=$(($COMP_CWORD - 1))
2546
-
2547
- local -a more_switches
2548
-
2549
- local -a comp_list
2550
-
2551
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
2552
- #>&2 echo "used_switches=$used_switches"
2553
- #>&2 echo "more_switches=$more_switches"
2554
-
2555
- # NOTE: Not doing anything special for ${subcmd2}.
2556
- # Are there sub-sub-commands we shoud list?
2557
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
2558
- comp_list=(
2559
- application
2560
- product
2561
- )
2562
- else
2563
- case $subcmd1 in
2564
- (application)
2565
- more_switches=(
2566
- {--trace}
2567
- )
2568
- ;;
2569
- (product)
2570
- more_switches=(
2571
- {--trace}
2572
- )
2573
- ;;
2574
- esac
2575
- fi
2576
-
2577
- # Add unused application-wide flags.
2578
- local idx
2579
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
2580
- local switch=${__app_switches[$idx]}
2581
- if ! contains_element "$switch" "${used_switches[@]}"; then
2582
- comp_list+=("$switch")
2583
- fi
2584
- done
2585
- # Add unused subcommand flags.
2586
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
2587
- local switch=${more_switches[$idx]}
2588
- comp_list+=("$switch")
2589
- done
2590
-
2591
- # If there are only --flags, <TAB> will put the common prefix,
2592
- # "--", but maybe the user doesn't want to add a flag after all.
2593
- if [[ -z ${last} ]]; then
2594
- local flags_only=true
2595
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
2596
- local switch=${comp_list[$idx]}
2597
- if [[ ${switch} != --* ]]; then
2598
- flags_only=false
2599
- break
2600
- fi
2601
- done
2602
- if ${flags_only}; then
2603
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
2604
- comp_list+=("  ")
2605
- fi
2606
- fi
2607
-
2608
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
2609
- }
2610
-
2611
- # Completion for subcommand: "mock".
2612
- function __murano-mock () {
2613
- local subcmd1="$1"
2614
- local subcmd2="$2"
2615
- #local subcmdn="$3"
2616
- local used_switches="${@:3}"
2617
- local last="${COMP_WORDS[COMP_CWORD]}"
2618
- local len=$(($COMP_CWORD - 1))
2619
-
2620
- local -a more_switches
2621
-
2622
- local -a comp_list
2623
-
2624
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
2625
- #>&2 echo "used_switches=$used_switches"
2626
- #>&2 echo "more_switches=$more_switches"
2627
-
2628
- # NOTE: Not doing anything special for ${subcmd2}.
2629
- # Are there sub-sub-commands we shoud list?
2630
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
2631
- comp_list=(
2632
- disable
2633
- enable
2634
- show
2635
- )
2636
- else
2637
- case $subcmd1 in
2638
- (disable)
2639
- more_switches=(
2640
- )
2641
- ;;
2642
- (enable)
2643
- more_switches=(
2644
- {--trace}
2645
- )
2646
- ;;
2647
- (show)
2648
- more_switches=(
2649
- )
2650
- ;;
2651
- esac
2652
- fi
2653
-
2654
- # Add unused application-wide flags.
2655
- local idx
2656
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
2657
- local switch=${__app_switches[$idx]}
2658
- if ! contains_element "$switch" "${used_switches[@]}"; then
2659
- comp_list+=("$switch")
2660
- fi
2661
- done
2662
- # Add unused subcommand flags.
2663
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
2664
- local switch=${more_switches[$idx]}
2665
- comp_list+=("$switch")
2666
- done
2667
-
2668
- # If there are only --flags, <TAB> will put the common prefix,
2669
- # "--", but maybe the user doesn't want to add a flag after all.
2670
- if [[ -z ${last} ]]; then
2671
- local flags_only=true
2672
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
2673
- local switch=${comp_list[$idx]}
2674
- if [[ ${switch} != --* ]]; then
2675
- flags_only=false
2676
- break
2677
- fi
2678
- done
2679
- if ${flags_only}; then
2680
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
2681
- comp_list+=("  ")
2682
- fi
2683
- fi
2684
-
2685
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
2686
- }
2687
-
2688
- # Completion for subcommand: "network".
2689
- function __murano-network () {
2690
- local subcmd1="$1"
2691
- local subcmd2="$2"
2692
- #local subcmdn="$3"
2693
- local used_switches="${@:3}"
2694
- local last="${COMP_WORDS[COMP_CWORD]}"
2695
- local len=$(($COMP_CWORD - 1))
2696
-
2697
- local -a more_switches
2698
-
2699
- local -a comp_list
2700
-
2701
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
2702
- #>&2 echo "used_switches=$used_switches"
2703
- #>&2 echo "more_switches=$more_switches"
2704
-
2705
- # NOTE: Not doing anything special for ${subcmd2}.
2706
- # Are there sub-sub-commands we shoud list?
2707
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
2708
- comp_list=(
2709
- children
2710
- configure
2711
- delete
2712
- new
2713
- show
2714
- )
2715
- else
2716
- case $subcmd1 in
2717
- (children)
2718
- more_switches=(
2719
- )
2720
- ;;
2721
- (configure)
2722
- more_switches=(
2723
- )
2724
- ;;
2725
- (delete)
2726
- more_switches=(
2727
- )
2728
- ;;
2729
- (new)
2730
- more_switches=(
2731
- )
2732
- ;;
2733
- (show)
2734
- more_switches=(
2735
- )
2736
- ;;
2737
- esac
2738
- fi
2739
-
2740
- # Add unused application-wide flags.
2741
- local idx
2742
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
2743
- local switch=${__app_switches[$idx]}
2744
- if ! contains_element "$switch" "${used_switches[@]}"; then
2745
- comp_list+=("$switch")
2746
- fi
2747
- done
2748
- # Add unused subcommand flags.
2749
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
2750
- local switch=${more_switches[$idx]}
2751
- comp_list+=("$switch")
2752
- done
2753
-
2754
- # If there are only --flags, <TAB> will put the common prefix,
2755
- # "--", but maybe the user doesn't want to add a flag after all.
2756
- if [[ -z ${last} ]]; then
2757
- local flags_only=true
2758
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
2759
- local switch=${comp_list[$idx]}
2760
- if [[ ${switch} != --* ]]; then
2761
- flags_only=false
2762
- break
2763
- fi
2764
- done
2765
- if ${flags_only}; then
2766
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
2767
- comp_list+=("  ")
2768
- fi
2769
- fi
2770
-
2771
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
2772
- }
2773
-
2774
- # Completion for subcommand: "password".
2775
- function __murano-password () {
2776
- local subcmd1="$1"
2777
- local subcmd2="$2"
2778
- #local subcmdn="$3"
2779
- local used_switches="${@:3}"
2780
- local last="${COMP_WORDS[COMP_CWORD]}"
2781
- local len=$(($COMP_CWORD - 1))
2782
-
2783
- local -a more_switches
2784
-
2785
- local -a comp_list
2786
-
2787
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
2788
- #>&2 echo "used_switches=$used_switches"
2789
- #>&2 echo "more_switches=$more_switches"
2790
-
2791
- # NOTE: Not doing anything special for ${subcmd2}.
2792
- # Are there sub-sub-commands we shoud list?
2793
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
2794
- comp_list=(
2795
- current
2796
- delete
2797
- list
2798
- set
2799
- )
2800
- else
2801
- case $subcmd1 in
2802
- (current)
2803
- more_switches=(
2804
- {--trace}
2805
- )
2806
- ;;
2807
- (delete)
2808
- more_switches=(
2809
- {--trace}
2810
- )
2811
- ;;
2812
- (list)
2813
- more_switches=(
2814
- )
2815
- ;;
2816
- (set)
2817
- more_switches=(
2818
- {--trace}
2819
- )
2820
- ;;
2821
- esac
2822
- fi
2823
-
2824
- # Add unused application-wide flags.
2825
- local idx
2826
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
2827
- local switch=${__app_switches[$idx]}
2828
- if ! contains_element "$switch" "${used_switches[@]}"; then
2829
- comp_list+=("$switch")
2830
- fi
2831
- done
2832
- # Add unused subcommand flags.
2833
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
2834
- local switch=${more_switches[$idx]}
2835
- comp_list+=("$switch")
2836
- done
2837
-
2838
- # If there are only --flags, <TAB> will put the common prefix,
2839
- # "--", but maybe the user doesn't want to add a flag after all.
2840
- if [[ -z ${last} ]]; then
2841
- local flags_only=true
2842
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
2843
- local switch=${comp_list[$idx]}
2844
- if [[ ${switch} != --* ]]; then
2845
- flags_only=false
2846
- break
2847
- fi
2848
- done
2849
- if ${flags_only}; then
2850
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
2851
- comp_list+=("  ")
2852
- fi
2853
- fi
2854
-
2855
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
2856
- }
2857
-
2858
- # Completion for subcommand: "passwords".
2859
- function __murano-passwords () {
2860
- local subcmd1="$1"
2861
- local subcmd2="$2"
2862
- #local subcmdn="$3"
2863
- local used_switches="${@:3}"
2864
- local last="${COMP_WORDS[COMP_CWORD]}"
2865
- local len=$(($COMP_CWORD - 1))
2866
-
2867
- local -a more_switches
2868
-
2869
- local -a comp_list
2870
-
2871
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
2872
- #>&2 echo "used_switches=$used_switches"
2873
- #>&2 echo "more_switches=$more_switches"
2874
-
2875
- # NOTE: Not doing anything special for ${subcmd2}.
2876
- # Are there sub-sub-commands we shoud list?
2877
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
2878
- comp_list=(
2879
- list
2880
- )
2881
- else
2882
- case $subcmd1 in
2883
- (list)
2884
- more_switches=(
2885
- )
2886
- ;;
2887
- esac
2888
- fi
2889
-
2890
- # Add unused application-wide flags.
2891
- local idx
2892
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
2893
- local switch=${__app_switches[$idx]}
2894
- if ! contains_element "$switch" "${used_switches[@]}"; then
2895
- comp_list+=("$switch")
2896
- fi
2897
- done
2898
- # Add unused subcommand flags.
2899
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
2900
- local switch=${more_switches[$idx]}
2901
- comp_list+=("$switch")
2902
- done
2903
-
2904
- # If there are only --flags, <TAB> will put the common prefix,
2905
- # "--", but maybe the user doesn't want to add a flag after all.
2906
- if [[ -z ${last} ]]; then
2907
- local flags_only=true
2908
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
2909
- local switch=${comp_list[$idx]}
2910
- if [[ ${switch} != --* ]]; then
2911
- flags_only=false
2912
- break
2913
- fi
2914
- done
2915
- if ${flags_only}; then
2916
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
2917
- comp_list+=("  ")
2918
- fi
2919
- fi
2920
-
2921
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
2922
- }
2923
-
2924
- # Completion for subcommand: "plugin".
2925
- function __murano-plugin () {
2926
- local subcmd1="$1"
2927
- local subcmd2="$2"
2928
- #local subcmdn="$3"
2929
- local used_switches="${@:3}"
2930
- local last="${COMP_WORDS[COMP_CWORD]}"
2931
- local len=$(($COMP_CWORD - 1))
2932
-
2933
- local -a more_switches
2934
-
2935
- local -a comp_list
2936
-
2937
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
2938
- #>&2 echo "used_switches=$used_switches"
2939
- #>&2 echo "more_switches=$more_switches"
2940
-
2941
- # NOTE: Not doing anything special for ${subcmd2}.
2942
- # Are there sub-sub-commands we shoud list?
2943
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
2944
- comp_list=(
2945
- install
2946
- list
2947
- registry
2948
- remove
2949
- source
2950
- )
2951
- else
2952
- case $subcmd1 in
2953
- (install)
2954
- more_switches=(
2955
- {--trace}
2956
- )
2957
- ;;
2958
- (list)
2959
- more_switches=(
2960
- )
2961
- ;;
2962
- (registry)
2963
- more_switches=(
2964
- )
2965
- ;;
2966
- (remove)
2967
- more_switches=(
2968
- )
2969
- ;;
2970
- (source)
2971
- more_switches=(
2972
- )
2973
- ;;
2974
- esac
2975
- fi
2976
-
2977
- # Add unused application-wide flags.
2978
- local idx
2979
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
2980
- local switch=${__app_switches[$idx]}
2981
- if ! contains_element "$switch" "${used_switches[@]}"; then
2982
- comp_list+=("$switch")
2983
- fi
2984
- done
2985
- # Add unused subcommand flags.
2986
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
2987
- local switch=${more_switches[$idx]}
2988
- comp_list+=("$switch")
2989
- done
2990
-
2991
- # If there are only --flags, <TAB> will put the common prefix,
2992
- # "--", but maybe the user doesn't want to add a flag after all.
2993
- if [[ -z ${last} ]]; then
2994
- local flags_only=true
2995
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
2996
- local switch=${comp_list[$idx]}
2997
- if [[ ${switch} != --* ]]; then
2998
- flags_only=false
2999
- break
3000
- fi
3001
- done
3002
- if ${flags_only}; then
3003
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
3004
- comp_list+=("  ")
3005
- fi
3006
- fi
3007
-
3008
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
3009
- }
3010
-
3011
- # Completion for subcommand: "postgresql".
3012
- function __murano-postgresql () {
3013
- local subcmd1="$1"
3014
- local subcmd2="$2"
3015
- #local subcmdn="$3"
3016
- local used_switches="${@:3}"
3017
- local last="${COMP_WORDS[COMP_CWORD]}"
3018
- local len=$(($COMP_CWORD - 1))
3019
-
3020
- local -a more_switches
3021
-
3022
- local -a comp_list
3023
-
3024
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
3025
- #>&2 echo "used_switches=$used_switches"
3026
- #>&2 echo "more_switches=$more_switches"
3027
-
3028
- # NOTE: Not doing anything special for ${subcmd2}.
3029
- # Are there sub-sub-commands we shoud list?
3030
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
3031
- comp_list=(
3032
- migrate
3033
- )
3034
- else
3035
- case $subcmd1 in
3036
- (migrate)
3037
- more_switches=(
3038
- {--trace}
3039
- )
3040
- ;;
3041
- esac
3042
- fi
3043
-
3044
- # Add unused application-wide flags.
3045
- local idx
3046
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
3047
- local switch=${__app_switches[$idx]}
3048
- if ! contains_element "$switch" "${used_switches[@]}"; then
3049
- comp_list+=("$switch")
3050
- fi
3051
- done
3052
- # Add unused subcommand flags.
3053
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
3054
- local switch=${more_switches[$idx]}
3055
- comp_list+=("$switch")
3056
- done
3057
-
3058
- # If there are only --flags, <TAB> will put the common prefix,
3059
- # "--", but maybe the user doesn't want to add a flag after all.
3060
- if [[ -z ${last} ]]; then
3061
- local flags_only=true
3062
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
3063
- local switch=${comp_list[$idx]}
3064
- if [[ ${switch} != --* ]]; then
3065
- flags_only=false
3066
- break
3067
- fi
3068
- done
3069
- if ${flags_only}; then
3070
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
3071
- comp_list+=("  ")
3072
- fi
3073
- fi
3074
-
3075
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
3076
- }
3077
-
3078
- # Completion for subcommand: "product".
3079
- function __murano-product () {
3080
- local subcmd1="$1"
3081
- local subcmd2="$2"
3082
- #local subcmdn="$3"
3083
- local used_switches="${@:3}"
3084
- local last="${COMP_WORDS[COMP_CWORD]}"
3085
- local len=$(($COMP_CWORD - 1))
3086
-
3087
- local -a more_switches
3088
-
3089
- local -a comp_list
3090
-
3091
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
3092
- #>&2 echo "used_switches=$used_switches"
3093
- #>&2 echo "more_switches=$more_switches"
3094
-
3095
- # NOTE: Not doing anything special for ${subcmd2}.
3096
- # Are there sub-sub-commands we shoud list?
3097
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
3098
- comp_list=(
3099
- create
3100
- delete
3101
- device
3102
- devices
3103
- diff
3104
- domain
3105
- find
3106
- list
3107
- logs
3108
- pull
3109
- push
3110
- usage
3111
- )
3112
- else
3113
- case $subcmd1 in
3114
- (create)
3115
- more_switches=(
3116
- {--trace}
3117
- )
3118
- ;;
3119
- (delete)
3120
- more_switches=(
3121
- {--trace}
3122
- )
3123
- ;;
3124
- (device)
3125
- more_switches=(
3126
- )
3127
- ;;
3128
- (devices)
3129
- more_switches=(
3130
- )
3131
- ;;
3132
- (diff)
3133
- more_switches=(
3134
- {--trace}
3135
- )
3136
- ;;
3137
- (domain)
3138
- more_switches=(
3139
- {--trace}
3140
- )
3141
- ;;
3142
- (find)
3143
- more_switches=(
3144
- {--trace}
3145
- )
3146
- ;;
3147
- (list)
3148
- more_switches=(
3149
- {--trace}
3150
- )
3151
- ;;
3152
- (logs)
3153
- more_switches=(
3154
- {--trace}
3155
- )
3156
- ;;
3157
- (pull)
3158
- more_switches=(
3159
- {--trace}
3160
- )
3161
- ;;
3162
- (push)
3163
- more_switches=(
3164
- {--trace}
3165
- )
3166
- ;;
3167
- (usage)
3168
- more_switches=(
3169
- {--trace}
3170
- )
3171
- ;;
3172
- esac
3173
- fi
3174
-
3175
- # Add unused application-wide flags.
3176
- local idx
3177
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
3178
- local switch=${__app_switches[$idx]}
3179
- if ! contains_element "$switch" "${used_switches[@]}"; then
3180
- comp_list+=("$switch")
3181
- fi
3182
- done
3183
- # Add unused subcommand flags.
3184
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
3185
- local switch=${more_switches[$idx]}
3186
- comp_list+=("$switch")
3187
- done
3188
-
3189
- # If there are only --flags, <TAB> will put the common prefix,
3190
- # "--", but maybe the user doesn't want to add a flag after all.
3191
- if [[ -z ${last} ]]; then
3192
- local flags_only=true
3193
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
3194
- local switch=${comp_list[$idx]}
3195
- if [[ ${switch} != --* ]]; then
3196
- flags_only=false
3197
- break
3198
- fi
3199
- done
3200
- if ${flags_only}; then
3201
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
3202
- comp_list+=("  ")
3203
- fi
3204
- fi
3205
-
3206
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
3207
- }
3208
-
3209
- # Completion for subcommand: "products".
3210
- function __murano-products () {
3211
- local subcmd1="$1"
3212
- local subcmd2="$2"
3213
- #local subcmdn="$3"
3214
- local used_switches="${@:3}"
3215
- local last="${COMP_WORDS[COMP_CWORD]}"
3216
- local len=$(($COMP_CWORD - 1))
3217
-
3218
- local -a more_switches
3219
-
3220
- local -a comp_list
3221
-
3222
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
3223
- #>&2 echo "used_switches=$used_switches"
3224
- #>&2 echo "more_switches=$more_switches"
3225
-
3226
- # NOTE: Not doing anything special for ${subcmd2}.
3227
- # Are there sub-sub-commands we shoud list?
3228
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
3229
- comp_list=(
3230
- list
3231
- )
3232
- else
3233
- case $subcmd1 in
3234
- (list)
3235
- more_switches=(
3236
- {--trace}
3237
- )
3238
- ;;
3239
- esac
3240
- fi
3241
-
3242
- # Add unused application-wide flags.
3243
- local idx
3244
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
3245
- local switch=${__app_switches[$idx]}
3246
- if ! contains_element "$switch" "${used_switches[@]}"; then
3247
- comp_list+=("$switch")
3248
- fi
3249
- done
3250
- # Add unused subcommand flags.
3251
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
3252
- local switch=${more_switches[$idx]}
3253
- comp_list+=("$switch")
3254
- done
3255
-
3256
- # If there are only --flags, <TAB> will put the common prefix,
3257
- # "--", but maybe the user doesn't want to add a flag after all.
3258
- if [[ -z ${last} ]]; then
3259
- local flags_only=true
3260
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
3261
- local switch=${comp_list[$idx]}
3262
- if [[ ${switch} != --* ]]; then
3263
- flags_only=false
3264
- break
3265
- fi
3266
- done
3267
- if ${flags_only}; then
3268
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
3269
- comp_list+=("  ")
3270
- fi
3271
- fi
3272
-
3273
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
3274
- }
3275
-
3276
- # Completion for subcommand: "pull".
3277
- function __murano-pull () {
3278
- local subcmd1="$1"
3279
- local subcmd2="$2"
3280
- #local subcmdn="$3"
3281
- local used_switches="${@:3}"
3282
- local last="${COMP_WORDS[COMP_CWORD]}"
3283
- local len=$(($COMP_CWORD - 1))
3284
-
3285
- local -a more_switches
3286
-
3287
- local -a comp_list
3288
-
3289
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
3290
- #>&2 echo "used_switches=$used_switches"
3291
- #>&2 echo "more_switches=$more_switches"
3292
-
3293
- # NOTE: Not doing anything special for ${subcmd2}.
3294
- # Are there sub-sub-commands we shoud list?
3295
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
3296
- comp_list=(
3297
- application
3298
- product
3299
- )
3300
- else
3301
- case $subcmd1 in
3302
- (application)
3303
- more_switches=(
3304
- {--trace}
3305
- )
3306
- ;;
3307
- (product)
3308
- more_switches=(
3309
- {--trace}
3310
- )
3311
- ;;
3312
- esac
3313
- fi
3314
-
3315
- # Add unused application-wide flags.
3316
- local idx
3317
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
3318
- local switch=${__app_switches[$idx]}
3319
- if ! contains_element "$switch" "${used_switches[@]}"; then
3320
- comp_list+=("$switch")
3321
- fi
3322
- done
3323
- # Add unused subcommand flags.
3324
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
3325
- local switch=${more_switches[$idx]}
3326
- comp_list+=("$switch")
3327
- done
3328
-
3329
- # If there are only --flags, <TAB> will put the common prefix,
3330
- # "--", but maybe the user doesn't want to add a flag after all.
3331
- if [[ -z ${last} ]]; then
3332
- local flags_only=true
3333
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
3334
- local switch=${comp_list[$idx]}
3335
- if [[ ${switch} != --* ]]; then
3336
- flags_only=false
3337
- break
3338
- fi
3339
- done
3340
- if ${flags_only}; then
3341
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
3342
- comp_list+=("  ")
3343
- fi
3344
- fi
3345
-
3346
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
3347
- }
3348
-
3349
- # Completion for subcommand: "push".
3350
- function __murano-push () {
3351
- local subcmd1="$1"
3352
- local subcmd2="$2"
3353
- #local subcmdn="$3"
3354
- local used_switches="${@:3}"
3355
- local last="${COMP_WORDS[COMP_CWORD]}"
3356
- local len=$(($COMP_CWORD - 1))
3357
-
3358
- local -a more_switches
3359
-
3360
- local -a comp_list
3361
-
3362
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
3363
- #>&2 echo "used_switches=$used_switches"
3364
- #>&2 echo "more_switches=$more_switches"
3365
-
3366
- # NOTE: Not doing anything special for ${subcmd2}.
3367
- # Are there sub-sub-commands we shoud list?
3368
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
3369
- comp_list=(
3370
- application
3371
- product
3372
- )
3373
- else
3374
- case $subcmd1 in
3375
- (application)
3376
- more_switches=(
3377
- {--trace}
3378
- )
3379
- ;;
3380
- (product)
3381
- more_switches=(
3382
- {--trace}
3383
- )
3384
- ;;
3385
- esac
3386
- fi
3387
-
3388
- # Add unused application-wide flags.
3389
- local idx
3390
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
3391
- local switch=${__app_switches[$idx]}
3392
- if ! contains_element "$switch" "${used_switches[@]}"; then
3393
- comp_list+=("$switch")
3394
- fi
3395
- done
3396
- # Add unused subcommand flags.
3397
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
3398
- local switch=${more_switches[$idx]}
3399
- comp_list+=("$switch")
3400
- done
3401
-
3402
- # If there are only --flags, <TAB> will put the common prefix,
3403
- # "--", but maybe the user doesn't want to add a flag after all.
3404
- if [[ -z ${last} ]]; then
3405
- local flags_only=true
3406
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
3407
- local switch=${comp_list[$idx]}
3408
- if [[ ${switch} != --* ]]; then
3409
- flags_only=false
3410
- break
3411
- fi
3412
- done
3413
- if ${flags_only}; then
3414
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
3415
- comp_list+=("  ")
3416
- fi
3417
- fi
3418
-
3419
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
3420
- }
3421
-
3422
- # Completion for subcommand: "service".
3423
- function __murano-service () {
3424
- local subcmd1="$1"
3425
- local subcmd2="$2"
3426
- #local subcmdn="$3"
3427
- local used_switches="${@:3}"
3428
- local last="${COMP_WORDS[COMP_CWORD]}"
3429
- local len=$(($COMP_CWORD - 1))
3430
-
3431
- local -a more_switches
3432
-
3433
- local -a comp_list
3434
-
3435
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
3436
- #>&2 echo "used_switches=$used_switches"
3437
- #>&2 echo "more_switches=$more_switches"
3438
-
3439
- # NOTE: Not doing anything special for ${subcmd2}.
3440
- # Are there sub-sub-commands we shoud list?
3441
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
3442
- comp_list=(
3443
- add
3444
- create
3445
- delete
3446
- get
3447
- list
3448
- remove
3449
- status
3450
- )
3451
- else
3452
- case $subcmd1 in
3453
- (add)
3454
- more_switches=(
3455
- {--trace}
3456
- )
3457
- ;;
3458
- (create)
3459
- more_switches=(
3460
- {--trace}
3461
- )
3462
- ;;
3463
- (delete)
3464
- more_switches=(
3465
- {--trace}
3466
- )
3467
- ;;
3468
- (get)
3469
- more_switches=(
3470
- {--trace}
3471
- )
3472
- ;;
3473
- (list)
3474
- more_switches=(
3475
- {--trace}
3476
- )
3477
- ;;
3478
- (remove)
3479
- more_switches=(
3480
- {--trace}
3481
- )
3482
- ;;
3483
- (status)
3484
- more_switches=(
3485
- {--trace}
3486
- )
3487
- ;;
3488
- esac
3489
- fi
3490
-
3491
- # Add unused application-wide flags.
3492
- local idx
3493
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
3494
- local switch=${__app_switches[$idx]}
3495
- if ! contains_element "$switch" "${used_switches[@]}"; then
3496
- comp_list+=("$switch")
3497
- fi
3498
- done
3499
- # Add unused subcommand flags.
3500
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
3501
- local switch=${more_switches[$idx]}
3502
- comp_list+=("$switch")
3503
- done
3504
-
3505
- # If there are only --flags, <TAB> will put the common prefix,
3506
- # "--", but maybe the user doesn't want to add a flag after all.
3507
- if [[ -z ${last} ]]; then
3508
- local flags_only=true
3509
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
3510
- local switch=${comp_list[$idx]}
3511
- if [[ ${switch} != --* ]]; then
3512
- flags_only=false
3513
- break
3514
- fi
3515
- done
3516
- if ${flags_only}; then
3517
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
3518
- comp_list+=("  ")
3519
- fi
3520
- fi
3521
-
3522
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
3523
- }
3524
-
3525
- # Completion for subcommand: "services".
3526
- function __murano-services () {
3527
- local subcmd1="$1"
3528
- local subcmd2="$2"
3529
- #local subcmdn="$3"
3530
- local used_switches="${@:3}"
3531
- local last="${COMP_WORDS[COMP_CWORD]}"
3532
- local len=$(($COMP_CWORD - 1))
3533
-
3534
- local -a more_switches
3535
-
3536
- local -a comp_list
3537
-
3538
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
3539
- #>&2 echo "used_switches=$used_switches"
3540
- #>&2 echo "more_switches=$more_switches"
3541
-
3542
- # NOTE: Not doing anything special for ${subcmd2}.
3543
- # Are there sub-sub-commands we shoud list?
3544
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
3545
- comp_list=(
3546
- list
3547
- )
3548
- else
3549
- case $subcmd1 in
3550
- (list)
3551
- more_switches=(
3552
- {--trace}
3553
- )
3554
- ;;
3555
- esac
3556
- fi
3557
-
3558
- # Add unused application-wide flags.
3559
- local idx
3560
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
3561
- local switch=${__app_switches[$idx]}
3562
- if ! contains_element "$switch" "${used_switches[@]}"; then
3563
- comp_list+=("$switch")
3564
- fi
3565
- done
3566
- # Add unused subcommand flags.
3567
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
3568
- local switch=${more_switches[$idx]}
3569
- comp_list+=("$switch")
3570
- done
3571
-
3572
- # If there are only --flags, <TAB> will put the common prefix,
3573
- # "--", but maybe the user doesn't want to add a flag after all.
3574
- if [[ -z ${last} ]]; then
3575
- local flags_only=true
3576
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
3577
- local switch=${comp_list[$idx]}
3578
- if [[ ${switch} != --* ]]; then
3579
- flags_only=false
3580
- break
3581
- fi
3582
- done
3583
- if ${flags_only}; then
3584
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
3585
- comp_list+=("  ")
3586
- fi
3587
- fi
3588
-
3589
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
3590
- }
3591
-
3592
- # Completion for subcommand: "setting".
3593
- function __murano-setting () {
3594
- local subcmd1="$1"
3595
- local subcmd2="$2"
3596
- #local subcmdn="$3"
3597
- local used_switches="${@:3}"
3598
- local last="${COMP_WORDS[COMP_CWORD]}"
3599
- local len=$(($COMP_CWORD - 1))
3600
-
3601
- local -a more_switches
3602
-
3603
- local -a comp_list
3604
-
3605
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
3606
- #>&2 echo "used_switches=$used_switches"
3607
- #>&2 echo "more_switches=$more_switches"
3608
-
3609
- # NOTE: Not doing anything special for ${subcmd2}.
3610
- # Are there sub-sub-commands we shoud list?
3611
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
3612
- comp_list=(
3613
- list
3614
- read
3615
- write
3616
- )
3617
- else
3618
- case $subcmd1 in
3619
- (list)
3620
- more_switches=(
3621
- )
3622
- ;;
3623
- (read)
3624
- more_switches=(
3625
- {--trace}
3626
- )
3627
- ;;
3628
- (write)
3629
- more_switches=(
3630
- {--trace}
3631
- )
3632
- ;;
3633
- esac
3634
- fi
3635
-
3636
- # Add unused application-wide flags.
3637
- local idx
3638
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
3639
- local switch=${__app_switches[$idx]}
3640
- if ! contains_element "$switch" "${used_switches[@]}"; then
3641
- comp_list+=("$switch")
3642
- fi
3643
- done
3644
- # Add unused subcommand flags.
3645
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
3646
- local switch=${more_switches[$idx]}
3647
- comp_list+=("$switch")
3648
- done
3649
-
3650
- # If there are only --flags, <TAB> will put the common prefix,
3651
- # "--", but maybe the user doesn't want to add a flag after all.
3652
- if [[ -z ${last} ]]; then
3653
- local flags_only=true
3654
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
3655
- local switch=${comp_list[$idx]}
3656
- if [[ ${switch} != --* ]]; then
3657
- flags_only=false
3658
- break
3659
- fi
3660
- done
3661
- if ${flags_only}; then
3662
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
3663
- comp_list+=("  ")
3664
- fi
3665
- fi
3666
-
3667
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
3668
- }
3669
-
3670
- # Completion for subcommand: "settings".
3671
- function __murano-settings () {
3672
- local subcmd1="$1"
3673
- local subcmd2="$2"
3674
- #local subcmdn="$3"
3675
- local used_switches="${@:3}"
3676
- local last="${COMP_WORDS[COMP_CWORD]}"
3677
- local len=$(($COMP_CWORD - 1))
3678
-
3679
- local -a more_switches
3680
-
3681
- local -a comp_list
3682
-
3683
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
3684
- #>&2 echo "used_switches=$used_switches"
3685
- #>&2 echo "more_switches=$more_switches"
3686
-
3687
- # NOTE: Not doing anything special for ${subcmd2}.
3688
- # Are there sub-sub-commands we shoud list?
3689
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
3690
- comp_list=(
3691
- list
3692
- )
3693
- else
3694
- case $subcmd1 in
3695
- (list)
3696
- more_switches=(
3697
- )
3698
- ;;
3699
- esac
3700
- fi
3701
-
3702
- # Add unused application-wide flags.
3703
- local idx
3704
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
3705
- local switch=${__app_switches[$idx]}
3706
- if ! contains_element "$switch" "${used_switches[@]}"; then
3707
- comp_list+=("$switch")
3708
- fi
3709
- done
3710
- # Add unused subcommand flags.
3711
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
3712
- local switch=${more_switches[$idx]}
3713
- comp_list+=("$switch")
3714
- done
3715
-
3716
- # If there are only --flags, <TAB> will put the common prefix,
3717
- # "--", but maybe the user doesn't want to add a flag after all.
3718
- if [[ -z ${last} ]]; then
3719
- local flags_only=true
3720
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
3721
- local switch=${comp_list[$idx]}
3722
- if [[ ${switch} != --* ]]; then
3723
- flags_only=false
3724
- break
3725
- fi
3726
- done
3727
- if ${flags_only}; then
3728
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
3729
- comp_list+=("  ")
3730
- fi
3731
- fi
3732
-
3733
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
3734
- }
3735
-
3736
- # Completion for subcommand: "show".
3737
- function __murano-show () {
3738
- local subcmd1="$1"
3739
- local subcmd2="$2"
3740
- #local subcmdn="$3"
3741
- local used_switches="${@:3}"
3742
- local last="${COMP_WORDS[COMP_CWORD]}"
3743
- local len=$(($COMP_CWORD - 1))
3744
-
3745
- local -a more_switches
3746
-
3747
- local -a comp_list
3748
-
3749
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
3750
- #>&2 echo "used_switches=$used_switches"
3751
- #>&2 echo "more_switches=$more_switches"
3752
-
3753
- # NOTE: Not doing anything special for ${subcmd2}.
3754
- # Are there sub-sub-commands we shoud list?
3755
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
3756
- comp_list=(
3757
- location
3758
- )
3759
- else
3760
- case $subcmd1 in
3761
- (location)
3762
- more_switches=(
3763
- )
3764
- ;;
3765
- esac
3766
- fi
3767
-
3768
- # Add unused application-wide flags.
3769
- local idx
3770
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
3771
- local switch=${__app_switches[$idx]}
3772
- if ! contains_element "$switch" "${used_switches[@]}"; then
3773
- comp_list+=("$switch")
3774
- fi
3775
- done
3776
- # Add unused subcommand flags.
3777
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
3778
- local switch=${more_switches[$idx]}
3779
- comp_list+=("$switch")
3780
- done
3781
-
3782
- # If there are only --flags, <TAB> will put the common prefix,
3783
- # "--", but maybe the user doesn't want to add a flag after all.
3784
- if [[ -z ${last} ]]; then
3785
- local flags_only=true
3786
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
3787
- local switch=${comp_list[$idx]}
3788
- if [[ ${switch} != --* ]]; then
3789
- flags_only=false
3790
- break
3791
- fi
3792
- done
3793
- if ${flags_only}; then
3794
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
3795
- comp_list+=("  ")
3796
- fi
3797
- fi
3798
-
3799
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
3800
- }
3801
-
3802
- # Completion for subcommand: "solution".
3803
- function __murano-solution () {
3804
- local subcmd1="$1"
3805
- local subcmd2="$2"
3806
- #local subcmdn="$3"
3807
- local used_switches="${@:3}"
3808
- local last="${COMP_WORDS[COMP_CWORD]}"
3809
- local len=$(($COMP_CWORD - 1))
3810
-
3811
- local -a more_switches
3812
-
3813
- local -a comp_list
3814
-
3815
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
3816
- #>&2 echo "used_switches=$used_switches"
3817
- #>&2 echo "more_switches=$more_switches"
3818
-
3819
- # NOTE: Not doing anything special for ${subcmd2}.
3820
- # Are there sub-sub-commands we shoud list?
3821
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
3822
- comp_list=(
3823
- create
3824
- delete
3825
- find
3826
- list
3827
- )
3828
- else
3829
- case $subcmd1 in
3830
- (create)
3831
- more_switches=(
3832
- {--trace}
3833
- )
3834
- ;;
3835
- (delete)
3836
- more_switches=(
3837
- {--trace}
3838
- )
3839
- ;;
3840
- (find)
3841
- more_switches=(
3842
- {--trace}
3843
- )
3844
- ;;
3845
- (list)
3846
- more_switches=(
3847
- {--trace}
3848
- )
3849
- ;;
3850
- esac
3851
- fi
3852
-
3853
- # Add unused application-wide flags.
3854
- local idx
3855
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
3856
- local switch=${__app_switches[$idx]}
3857
- if ! contains_element "$switch" "${used_switches[@]}"; then
3858
- comp_list+=("$switch")
3859
- fi
3860
- done
3861
- # Add unused subcommand flags.
3862
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
3863
- local switch=${more_switches[$idx]}
3864
- comp_list+=("$switch")
3865
- done
3866
-
3867
- # If there are only --flags, <TAB> will put the common prefix,
3868
- # "--", but maybe the user doesn't want to add a flag after all.
3869
- if [[ -z ${last} ]]; then
3870
- local flags_only=true
3871
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
3872
- local switch=${comp_list[$idx]}
3873
- if [[ ${switch} != --* ]]; then
3874
- flags_only=false
3875
- break
3876
- fi
3877
- done
3878
- if ${flags_only}; then
3879
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
3880
- comp_list+=("  ")
3881
- fi
3882
- fi
3883
-
3884
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
3885
- }
3886
-
3887
- # Completion for subcommand: "solutions".
3888
- function __murano-solutions () {
3889
- local subcmd1="$1"
3890
- local subcmd2="$2"
3891
- #local subcmdn="$3"
3892
- local used_switches="${@:3}"
3893
- local last="${COMP_WORDS[COMP_CWORD]}"
3894
- local len=$(($COMP_CWORD - 1))
3895
-
3896
- local -a more_switches
3897
-
3898
- local -a comp_list
3899
-
3900
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
3901
- #>&2 echo "used_switches=$used_switches"
3902
- #>&2 echo "more_switches=$more_switches"
3903
-
3904
- # NOTE: Not doing anything special for ${subcmd2}.
3905
- # Are there sub-sub-commands we shoud list?
3906
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
3907
- comp_list=(
3908
- expunge
3909
- list
3910
- )
3911
- else
3912
- case $subcmd1 in
3913
- (expunge)
3914
- more_switches=(
3915
- {--trace}
3916
- )
3917
- ;;
3918
- (list)
3919
- more_switches=(
3920
- {--trace}
3921
- )
3922
- ;;
3923
- esac
3924
- fi
3925
-
3926
- # Add unused application-wide flags.
3927
- local idx
3928
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
3929
- local switch=${__app_switches[$idx]}
3930
- if ! contains_element "$switch" "${used_switches[@]}"; then
3931
- comp_list+=("$switch")
3932
- fi
3933
- done
3934
- # Add unused subcommand flags.
3935
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
3936
- local switch=${more_switches[$idx]}
3937
- comp_list+=("$switch")
3938
- done
3939
-
3940
- # If there are only --flags, <TAB> will put the common prefix,
3941
- # "--", but maybe the user doesn't want to add a flag after all.
3942
- if [[ -z ${last} ]]; then
3943
- local flags_only=true
3944
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
3945
- local switch=${comp_list[$idx]}
3946
- if [[ ${switch} != --* ]]; then
3947
- flags_only=false
3948
- break
3949
- fi
3950
- done
3951
- if ${flags_only}; then
3952
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
3953
- comp_list+=("  ")
3954
- fi
3955
- fi
3956
-
3957
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
3958
- }
3959
-
3960
- # Completion for subcommand: "status".
3961
- function __murano-status () {
3962
- local subcmd1="$1"
3963
- local subcmd2="$2"
3964
- #local subcmdn="$3"
3965
- local used_switches="${@:3}"
3966
- local last="${COMP_WORDS[COMP_CWORD]}"
3967
- local len=$(($COMP_CWORD - 1))
3968
-
3969
- local -a more_switches
3970
-
3971
- local -a comp_list
3972
-
3973
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
3974
- #>&2 echo "used_switches=$used_switches"
3975
- #>&2 echo "more_switches=$more_switches"
3976
-
3977
- # NOTE: Not doing anything special for ${subcmd2}.
3978
- # Are there sub-sub-commands we shoud list?
3979
-
3980
- # Add unused application-wide flags.
3981
- local idx
3982
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
3983
- local switch=${__app_switches[$idx]}
3984
- if ! contains_element "$switch" "${used_switches[@]}"; then
3985
- comp_list+=("$switch")
3986
- fi
3987
- done
3988
- # Add unused subcommand flags.
3989
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
3990
- local switch=${more_switches[$idx]}
3991
- comp_list+=("$switch")
3992
- done
3993
-
3994
- # If there are only --flags, <TAB> will put the common prefix,
3995
- # "--", but maybe the user doesn't want to add a flag after all.
3996
- if [[ -z ${last} ]]; then
3997
- local flags_only=true
3998
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
3999
- local switch=${comp_list[$idx]}
4000
- if [[ ${switch} != --* ]]; then
4001
- flags_only=false
4002
- break
4003
- fi
4004
- done
4005
- if ${flags_only}; then
4006
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
4007
- comp_list+=("  ")
4008
- fi
4009
- fi
4010
-
4011
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
4012
- }
4013
-
4014
- # Completion for subcommand: "syncdown".
4015
- function __murano-syncdown () {
4016
- local subcmd1="$1"
4017
- local subcmd2="$2"
4018
- #local subcmdn="$3"
4019
- local used_switches="${@:3}"
4020
- local last="${COMP_WORDS[COMP_CWORD]}"
4021
- local len=$(($COMP_CWORD - 1))
4022
-
4023
- local -a more_switches
4024
-
4025
- local -a comp_list
4026
-
4027
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
4028
- #>&2 echo "used_switches=$used_switches"
4029
- #>&2 echo "more_switches=$more_switches"
4030
-
4031
- # NOTE: Not doing anything special for ${subcmd2}.
4032
- # Are there sub-sub-commands we shoud list?
4033
-
4034
- # Add unused application-wide flags.
4035
- local idx
4036
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
4037
- local switch=${__app_switches[$idx]}
4038
- if ! contains_element "$switch" "${used_switches[@]}"; then
4039
- comp_list+=("$switch")
4040
- fi
4041
- done
4042
- # Add unused subcommand flags.
4043
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
4044
- local switch=${more_switches[$idx]}
4045
- comp_list+=("$switch")
4046
- done
4047
-
4048
- # If there are only --flags, <TAB> will put the common prefix,
4049
- # "--", but maybe the user doesn't want to add a flag after all.
4050
- if [[ -z ${last} ]]; then
4051
- local flags_only=true
4052
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
4053
- local switch=${comp_list[$idx]}
4054
- if [[ ${switch} != --* ]]; then
4055
- flags_only=false
4056
- break
4057
- fi
4058
- done
4059
- if ${flags_only}; then
4060
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
4061
- comp_list+=("  ")
4062
- fi
4063
- fi
4064
-
4065
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
4066
- }
4067
-
4068
- # Completion for subcommand: "syncup".
4069
- function __murano-syncup () {
4070
- local subcmd1="$1"
4071
- local subcmd2="$2"
4072
- #local subcmdn="$3"
4073
- local used_switches="${@:3}"
4074
- local last="${COMP_WORDS[COMP_CWORD]}"
4075
- local len=$(($COMP_CWORD - 1))
4076
-
4077
- local -a more_switches
4078
-
4079
- local -a comp_list
4080
-
4081
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
4082
- #>&2 echo "used_switches=$used_switches"
4083
- #>&2 echo "more_switches=$more_switches"
4084
-
4085
- # NOTE: Not doing anything special for ${subcmd2}.
4086
- # Are there sub-sub-commands we shoud list?
4087
-
4088
- # Add unused application-wide flags.
4089
- local idx
4090
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
4091
- local switch=${__app_switches[$idx]}
4092
- if ! contains_element "$switch" "${used_switches[@]}"; then
4093
- comp_list+=("$switch")
4094
- fi
4095
- done
4096
- # Add unused subcommand flags.
4097
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
4098
- local switch=${more_switches[$idx]}
4099
- comp_list+=("$switch")
4100
- done
4101
-
4102
- # If there are only --flags, <TAB> will put the common prefix,
4103
- # "--", but maybe the user doesn't want to add a flag after all.
4104
- if [[ -z ${last} ]]; then
4105
- local flags_only=true
4106
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
4107
- local switch=${comp_list[$idx]}
4108
- if [[ ${switch} != --* ]]; then
4109
- flags_only=false
4110
- break
4111
- fi
4112
- done
4113
- if ${flags_only}; then
4114
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
4115
- comp_list+=("  ")
4116
- fi
4117
- fi
4118
-
4119
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
4120
- }
4121
-
4122
- # Completion for subcommand: "token".
4123
- function __murano-token () {
4124
- local subcmd1="$1"
4125
- local subcmd2="$2"
4126
- #local subcmdn="$3"
4127
- local used_switches="${@:3}"
4128
- local last="${COMP_WORDS[COMP_CWORD]}"
4129
- local len=$(($COMP_CWORD - 1))
4130
-
4131
- local -a more_switches
4132
-
4133
- local -a comp_list
4134
-
4135
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
4136
- #>&2 echo "used_switches=$used_switches"
4137
- #>&2 echo "more_switches=$more_switches"
4138
-
4139
- # NOTE: Not doing anything special for ${subcmd2}.
4140
- # Are there sub-sub-commands we shoud list?
4141
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
4142
- comp_list=(
4143
- delete
4144
- fetch
4145
- get
4146
- list
4147
- set
4148
- )
4149
- else
4150
- case $subcmd1 in
4151
- (delete)
4152
- more_switches=(
4153
- {--trace}
4154
- )
4155
- ;;
4156
- (fetch)
4157
- more_switches=(
4158
- {--trace}
4159
- )
4160
- ;;
4161
- (get)
4162
- more_switches=(
4163
- {--trace}
4164
- )
4165
- ;;
4166
- (list)
4167
- more_switches=(
4168
- )
4169
- ;;
4170
- (set)
4171
- more_switches=(
4172
- {--trace}
4173
- )
4174
- ;;
4175
- esac
4176
- fi
4177
-
4178
- # Add unused application-wide flags.
4179
- local idx
4180
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
4181
- local switch=${__app_switches[$idx]}
4182
- if ! contains_element "$switch" "${used_switches[@]}"; then
4183
- comp_list+=("$switch")
4184
- fi
4185
- done
4186
- # Add unused subcommand flags.
4187
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
4188
- local switch=${more_switches[$idx]}
4189
- comp_list+=("$switch")
4190
- done
4191
-
4192
- # If there are only --flags, <TAB> will put the common prefix,
4193
- # "--", but maybe the user doesn't want to add a flag after all.
4194
- if [[ -z ${last} ]]; then
4195
- local flags_only=true
4196
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
4197
- local switch=${comp_list[$idx]}
4198
- if [[ ${switch} != --* ]]; then
4199
- flags_only=false
4200
- break
4201
- fi
4202
- done
4203
- if ${flags_only}; then
4204
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
4205
- comp_list+=("  ")
4206
- fi
4207
- fi
4208
-
4209
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
4210
- }
4211
-
4212
- # Completion for subcommand: "tokens".
4213
- function __murano-tokens () {
4214
- local subcmd1="$1"
4215
- local subcmd2="$2"
4216
- #local subcmdn="$3"
4217
- local used_switches="${@:3}"
4218
- local last="${COMP_WORDS[COMP_CWORD]}"
4219
- local len=$(($COMP_CWORD - 1))
4220
-
4221
- local -a more_switches
4222
-
4223
- local -a comp_list
4224
-
4225
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
4226
- #>&2 echo "used_switches=$used_switches"
4227
- #>&2 echo "more_switches=$more_switches"
4228
-
4229
- # NOTE: Not doing anything special for ${subcmd2}.
4230
- # Are there sub-sub-commands we shoud list?
4231
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
4232
- comp_list=(
4233
- list
4234
- )
4235
- else
4236
- case $subcmd1 in
4237
- (list)
4238
- more_switches=(
4239
- )
4240
- ;;
4241
- esac
4242
- fi
4243
-
4244
- # Add unused application-wide flags.
4245
- local idx
4246
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
4247
- local switch=${__app_switches[$idx]}
4248
- if ! contains_element "$switch" "${used_switches[@]}"; then
4249
- comp_list+=("$switch")
4250
- fi
4251
- done
4252
- # Add unused subcommand flags.
4253
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
4254
- local switch=${more_switches[$idx]}
4255
- comp_list+=("$switch")
4256
- done
4257
-
4258
- # If there are only --flags, <TAB> will put the common prefix,
4259
- # "--", but maybe the user doesn't want to add a flag after all.
4260
- if [[ -z ${last} ]]; then
4261
- local flags_only=true
4262
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
4263
- local switch=${comp_list[$idx]}
4264
- if [[ ${switch} != --* ]]; then
4265
- flags_only=false
4266
- break
4267
- fi
4268
- done
4269
- if ${flags_only}; then
4270
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
4271
- comp_list+=("  ")
4272
- fi
4273
- fi
4274
-
4275
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
4276
- }
4277
-
4278
- # Completion for subcommand: "tsdb".
4279
- function __murano-tsdb () {
4280
- local subcmd1="$1"
4281
- local subcmd2="$2"
4282
- #local subcmdn="$3"
4283
- local used_switches="${@:3}"
4284
- local last="${COMP_WORDS[COMP_CWORD]}"
4285
- local len=$(($COMP_CWORD - 1))
4286
-
4287
- local -a more_switches
4288
-
4289
- local -a comp_list
4290
-
4291
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
4292
- #>&2 echo "used_switches=$used_switches"
4293
- #>&2 echo "more_switches=$more_switches"
4294
-
4295
- # NOTE: Not doing anything special for ${subcmd2}.
4296
- # Are there sub-sub-commands we shoud list?
4297
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
4298
- comp_list=(
4299
- list
4300
- query
4301
- write
4302
- )
4303
- else
4304
- case $subcmd1 in
4305
- (list)
4306
- more_switches=(
4307
- )
4308
- ;;
4309
- (query)
4310
- more_switches=(
4311
- {--trace}
4312
- )
4313
- ;;
4314
- (write)
4315
- more_switches=(
4316
- {--trace}
4317
- )
4318
- ;;
4319
- esac
4320
- fi
4321
-
4322
- # Add unused application-wide flags.
4323
- local idx
4324
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
4325
- local switch=${__app_switches[$idx]}
4326
- if ! contains_element "$switch" "${used_switches[@]}"; then
4327
- comp_list+=("$switch")
4328
- fi
4329
- done
4330
- # Add unused subcommand flags.
4331
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
4332
- local switch=${more_switches[$idx]}
4333
- comp_list+=("$switch")
4334
- done
4335
-
4336
- # If there are only --flags, <TAB> will put the common prefix,
4337
- # "--", but maybe the user doesn't want to add a flag after all.
4338
- if [[ -z ${last} ]]; then
4339
- local flags_only=true
4340
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
4341
- local switch=${comp_list[$idx]}
4342
- if [[ ${switch} != --* ]]; then
4343
- flags_only=false
4344
- break
4345
- fi
4346
- done
4347
- if ${flags_only}; then
4348
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
4349
- comp_list+=("  ")
4350
- fi
4351
- fi
4352
-
4353
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
4354
- }
4355
-
4356
- # Completion for subcommand: "usage".
4357
- function __murano-usage () {
4358
- local subcmd1="$1"
4359
- local subcmd2="$2"
4360
- #local subcmdn="$3"
4361
- local used_switches="${@:3}"
4362
- local last="${COMP_WORDS[COMP_CWORD]}"
4363
- local len=$(($COMP_CWORD - 1))
4364
-
4365
- local -a more_switches
4366
-
4367
- local -a comp_list
4368
-
4369
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
4370
- #>&2 echo "used_switches=$used_switches"
4371
- #>&2 echo "more_switches=$more_switches"
4372
-
4373
- # NOTE: Not doing anything special for ${subcmd2}.
4374
- # Are there sub-sub-commands we shoud list?
4375
- if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
4376
- comp_list=(
4377
- application
4378
- product
4379
- )
4380
- else
4381
- case $subcmd1 in
4382
- (application)
4383
- more_switches=(
4384
- {--trace}
4385
- )
4386
- ;;
4387
- (product)
4388
- more_switches=(
4389
- {--trace}
4390
- )
4391
- ;;
4392
- esac
4393
- fi
4394
-
4395
- # Add unused application-wide flags.
4396
- local idx
4397
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
4398
- local switch=${__app_switches[$idx]}
4399
- if ! contains_element "$switch" "${used_switches[@]}"; then
4400
- comp_list+=("$switch")
4401
- fi
4402
- done
4403
- # Add unused subcommand flags.
4404
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
4405
- local switch=${more_switches[$idx]}
4406
- comp_list+=("$switch")
4407
- done
4408
-
4409
- # If there are only --flags, <TAB> will put the common prefix,
4410
- # "--", but maybe the user doesn't want to add a flag after all.
4411
- if [[ -z ${last} ]]; then
4412
- local flags_only=true
4413
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
4414
- local switch=${comp_list[$idx]}
4415
- if [[ ${switch} != --* ]]; then
4416
- flags_only=false
4417
- break
4418
- fi
4419
- done
4420
- if ${flags_only}; then
4421
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
4422
- comp_list+=("  ")
4423
- fi
4424
- fi
4425
-
4426
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
4427
- }
4428
-
4429
- # Completion for subcommand: "whoami".
4430
- function __murano-whoami () {
4431
- local subcmd1="$1"
4432
- local subcmd2="$2"
4433
- #local subcmdn="$3"
4434
- local used_switches="${@:3}"
4435
- local last="${COMP_WORDS[COMP_CWORD]}"
4436
- local len=$(($COMP_CWORD - 1))
4437
-
4438
- local -a more_switches
4439
-
4440
- local -a comp_list
4441
-
4442
- #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
4443
- #>&2 echo "used_switches=$used_switches"
4444
- #>&2 echo "more_switches=$more_switches"
4445
-
4446
- # NOTE: Not doing anything special for ${subcmd2}.
4447
- # Are there sub-sub-commands we shoud list?
4448
-
4449
- # Add unused application-wide flags.
4450
- local idx
4451
- for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
4452
- local switch=${__app_switches[$idx]}
4453
- if ! contains_element "$switch" "${used_switches[@]}"; then
4454
- comp_list+=("$switch")
4455
- fi
4456
- done
4457
- # Add unused subcommand flags.
4458
- for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
4459
- local switch=${more_switches[$idx]}
4460
- comp_list+=("$switch")
4461
- done
4462
-
4463
- # If there are only --flags, <TAB> will put the common prefix,
4464
- # "--", but maybe the user doesn't want to add a flag after all.
4465
- if [[ -z ${last} ]]; then
4466
- local flags_only=true
4467
- for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
4468
- local switch=${comp_list[$idx]}
4469
- if [[ ${switch} != --* ]]; then
4470
- flags_only=false
4471
- break
4472
- fi
4473
- done
4474
- if ${flags_only}; then
4475
- # Use two Unicode en spaces to prevent compgen from prefixing "--".
4476
- comp_list+=("  ")
4477
- fi
4478
- fi
4479
-
4480
- COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
4481
- }
4482
-
4483
- complete -F _murano murano
4484
-