MuranoCLI 3.2.0.beta.9 → 3.2.1.pre.beta.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/Rakefile +5 -0
- data/dockers/README.rst +7 -0
- data/dockers/RELEASE.rst +6 -3
- data/dockers/docker-test.sh +45 -17
- data/docs/completions/murano_completion-bash +211 -86
- data/lib/MrMurano/Account.rb +72 -4
- data/lib/MrMurano/Business.rb +163 -2
- data/lib/MrMurano/Commander-Entry.rb +1 -2
- data/lib/MrMurano/Config.rb +19 -18
- data/lib/MrMurano/Content.rb +26 -19
- data/lib/MrMurano/Gateway.rb +51 -10
- data/lib/MrMurano/ReCommander.rb +1 -1
- data/lib/MrMurano/Solution-Services.rb +80 -35
- data/lib/MrMurano/Solution-Users.rb +1 -0
- data/lib/MrMurano/SyncRoot.rb +10 -3
- data/lib/MrMurano/SyncUpDown-Core.rb +47 -36
- data/lib/MrMurano/SyncUpDown-Item.rb +46 -14
- data/lib/MrMurano/SyncUpDown.rb +22 -20
- data/lib/MrMurano/Webservice-Endpoint.rb +20 -18
- data/lib/MrMurano/Webservice-File.rb +63 -20
- data/lib/MrMurano/commands/business.rb +14 -1
- data/lib/MrMurano/commands/child.rb +148 -0
- data/lib/MrMurano/commands/devices.rb +298 -149
- data/lib/MrMurano/commands/element.rb +2 -1
- data/lib/MrMurano/commands/globals.rb +3 -0
- data/lib/MrMurano/commands/network.rb +152 -33
- data/lib/MrMurano/commands/sync.rb +2 -2
- data/lib/MrMurano/commands.rb +1 -0
- data/lib/MrMurano/verbosing.rb +13 -2
- data/lib/MrMurano/version.rb +1 -1
- data/spec/Account_spec.rb +43 -11
- data/spec/Content_spec.rb +5 -3
- data/spec/GatewayBase_spec.rb +1 -1
- data/spec/GatewayDevice_spec.rb +47 -8
- data/spec/GatewayResource_spec.rb +1 -1
- data/spec/GatewaySettings_spec.rb +1 -1
- data/spec/HttpAuthed_spec.rb +17 -3
- data/spec/ProjectFile_spec.rb +59 -23
- data/spec/Setting_spec.rb +2 -1
- data/spec/Solution-ServiceConfig_spec.rb +1 -1
- data/spec/Solution-ServiceEventHandler_spec.rb +27 -20
- data/spec/Solution-ServiceModules_spec.rb +7 -5
- data/spec/Solution-UsersRoles_spec.rb +7 -1
- data/spec/Solution_spec.rb +9 -1
- data/spec/SyncRoot_spec.rb +5 -5
- data/spec/SyncUpDown_spec.rb +262 -211
- data/spec/Verbosing_spec.rb +49 -8
- data/spec/Webservice-Cors_spec.rb +10 -1
- data/spec/Webservice-Endpoint_spec.rb +84 -65
- data/spec/Webservice-File_spec.rb +16 -11
- data/spec/Webservice-Setting_spec.rb +7 -1
- data/spec/_workspace.rb +9 -0
- data/spec/cmd_business_spec.rb +5 -10
- data/spec/cmd_common.rb +67 -32
- data/spec/cmd_config_spec.rb +9 -14
- data/spec/cmd_content_spec.rb +15 -26
- data/spec/cmd_cors_spec.rb +9 -12
- data/spec/cmd_device_spec.rb +31 -45
- data/spec/cmd_domain_spec.rb +12 -10
- data/spec/cmd_element_spec.rb +18 -17
- data/spec/cmd_exchange_spec.rb +1 -4
- data/spec/cmd_init_spec.rb +56 -72
- data/spec/cmd_keystore_spec.rb +17 -26
- data/spec/cmd_link_spec.rb +13 -17
- data/spec/cmd_password_spec.rb +9 -10
- data/spec/cmd_setting_application_spec.rb +95 -68
- data/spec/cmd_setting_product_spec.rb +59 -37
- data/spec/cmd_status_spec.rb +46 -84
- data/spec/cmd_syncdown_application_spec.rb +28 -50
- data/spec/cmd_syncdown_both_spec.rb +44 -93
- data/spec/cmd_syncdown_unit_spec.rb +858 -0
- data/spec/cmd_syncup_spec.rb +21 -56
- data/spec/cmd_token_spec.rb +0 -3
- data/spec/cmd_usage_spec.rb +15 -10
- data/spec/dry_run_formatter.rb +1 -0
- data/spec/fixtures/dumped_config +4 -4
- data/spec/spec_helper.rb +3 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da25ca3b8f76c8441e11b57712ef6d7a536cf9c70a92e03822131e29dbaf4019
|
4
|
+
data.tar.gz: 68dfdbefe7259168d61e30009e305a79d505cc503ae94b86b982947724d0c588
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ccdbdbfa174682349eaef3f788d031fdc6f785ac4369cf798132dc6efdd0361c0dc61f5d3bf531d6775f2589630704c799bed9ecd9e38119e4f5ddd0fa7ed0db
|
7
|
+
data.tar.gz: 83e03633309260f8e50eb35b6641a48474f89f4aac27d5229b5ac1b549bf3f1a1fa0795d799c89cb38f0f1c5431162bb21828d21f64235fd69d5a72367602925
|
data/.rubocop.yml
CHANGED
@@ -285,4 +285,7 @@ AllCops:
|
|
285
285
|
#
|
286
286
|
# The spec_helper is a generated file; don't care.
|
287
287
|
- 'spec/spec_helper.rb'
|
288
|
+
# The unit test for syncdown has a ton of copy-paste curl output,
|
289
|
+
# which would be super duper tedious to clean up for the linter.
|
290
|
+
- 'spec/cmd_syncdown_unit_spec.rb'
|
288
291
|
|
data/Rakefile
CHANGED
@@ -88,6 +88,11 @@ task :rubocop do
|
|
88
88
|
end
|
89
89
|
task lint: :rubocop
|
90
90
|
|
91
|
+
desc 'Run Rubocop linter through `less`'
|
92
|
+
task 'lint-less' do
|
93
|
+
system %(rubocop --color -D -c .rubocop.yml | less -r)
|
94
|
+
end
|
95
|
+
|
91
96
|
desc 'Clean out junk from prior hot tests'
|
92
97
|
task :test_clean_up do
|
93
98
|
unless ENV['MURANO_CONFIGFILE'].nil?
|
data/dockers/README.rst
CHANGED
@@ -305,18 +305,25 @@ Jenkins project configuration: Murano CLI Gem Release
|
|
305
305
|
- Notifications
|
306
306
|
|
307
307
|
- Notification Type: ``Build started``
|
308
|
+
Color: ``purple``
|
308
309
|
|
309
310
|
- Notification Type: ``Build aborted``
|
311
|
+
Color: ``red``
|
310
312
|
|
311
313
|
- Notification Type: ``Build successful``
|
314
|
+
Color: ``green``
|
312
315
|
|
313
316
|
- Notification Type: ``Build failed``
|
317
|
+
Color: ``red``
|
314
318
|
|
315
319
|
- Notification Type: ``Module not built``
|
320
|
+
Color: ``red``
|
316
321
|
|
317
322
|
- Notification Type: ``Build is back to normal``
|
323
|
+
Color: ``yellow``
|
318
324
|
|
319
325
|
- Notification Type: ``Build is unstable``
|
326
|
+
Color: ``yellow``
|
320
327
|
|
321
328
|
Job started::
|
322
329
|
|
data/dockers/RELEASE.rst
CHANGED
@@ -58,8 +58,8 @@ Trigger the Gem release build
|
|
58
58
|
Set the variables above, and then tag the appropriate branch::
|
59
59
|
|
60
60
|
cd ${MURCLI_BASE}/exosite+MuranoCLI
|
61
|
-
git checkout ${
|
62
|
-
git pull
|
61
|
+
git checkout ${MURCLI_REF}
|
62
|
+
git pull --ff-only
|
63
63
|
|
64
64
|
git tag -a "${MURCLI_REL}" -m "Release tag: ${MURCLI_REL}" ${MURCLI_REF}
|
65
65
|
git push origin "${MURCLI_REL}"
|
@@ -101,6 +101,7 @@ Download the built Gem from GitHub::
|
|
101
101
|
--location \
|
102
102
|
https://api.github.com/repos/${OWNER}/${REPO}/releases/tags/v${MURCLI_VER}
|
103
103
|
cat v${MURCLI_VER}
|
104
|
+
#
|
104
105
|
ASSET_ID=$(cat v${MURCLI_VER} | jq '.assets[0].id')
|
105
106
|
echo ${ASSET_ID}
|
106
107
|
#
|
@@ -110,13 +111,15 @@ Download the built Gem from GitHub::
|
|
110
111
|
--header='Accept:application/octet-stream' \
|
111
112
|
https://${GITHUB_TOKEN}:@api.github.com/repos/${OWNER}/${REPO}/releases/assets/${ASSET_ID} \
|
112
113
|
-O MuranoCLI-${MURCLI_VER}.gem
|
114
|
+
ls -la MuranoCLI-${MURCLI_VER}.gem
|
113
115
|
|
114
116
|
Publish the gem::
|
115
117
|
|
116
118
|
gem push MuranoCLI-${MURCLI_VER}.gem
|
117
119
|
popd
|
118
120
|
rm /tmp/gem_push/MuranoCLI-${MURCLI_VER}.gem
|
119
|
-
rm /tmp/gem_push
|
121
|
+
rm /tmp/gem_push/v${MURCLI_VER}
|
122
|
+
rm /tmp/gem_push/releases
|
120
123
|
rmdir /tmp/gem_push
|
121
124
|
|
122
125
|
Test!::
|
data/dockers/docker-test.sh
CHANGED
@@ -48,6 +48,11 @@ must_verify_environs () {
|
|
48
48
|
[[ -z ${MURANO_USERNAME} ]] && echo "ERROR: Please set MURANO_USERNAME" && exit 1
|
49
49
|
[[ -z ${MURANO_PASSWORD} ]] && echo "ERROR: Please set MURANO_PASSWORD" && exit 1
|
50
50
|
[[ -z ${MURANO_BUSINESS} ]] && echo "ERROR: Please set MURANO_BUSINESS" && exit 1
|
51
|
+
|
52
|
+
# TEST_ME: (lb): I bet WORKSPACE is set to /app on Docker.
|
53
|
+
if [[ -d /app && "${WORKSPACE}" != "/app" ]]; then
|
54
|
+
echo "WARNING: WORKSPACE not /app?: ${WORKSPACE}"
|
55
|
+
fi
|
51
56
|
}
|
52
57
|
|
53
58
|
# Create a basic Murano CLI config indicating the Murano account credentials.
|
@@ -55,8 +60,10 @@ must_verify_environs () {
|
|
55
60
|
# Default to host "bizapi-staging.hosted.exosite.io".
|
56
61
|
export MURANO_BIZAPIIO=${MURANO_BIZAPIIO:-bizapi-staging.hosted.exosite.io}
|
57
62
|
|
63
|
+
export MURANO_CONFIGFILE="${MURANO_CONFIGFILE:-${WORKSPACE}/test.run.muranocfg}"
|
64
|
+
|
58
65
|
create_basic_config () {
|
59
|
-
cat > "${
|
66
|
+
cat > "${MURANO_CONFIGFILE}" <<-EOCFB
|
60
67
|
[user]
|
61
68
|
name = ${MURANO_USERNAME}
|
62
69
|
[business]
|
@@ -64,21 +71,28 @@ create_basic_config () {
|
|
64
71
|
[net]
|
65
72
|
host = ${MURANO_BIZAPIIO}
|
66
73
|
EOCFB
|
67
|
-
|
74
|
+
}
|
75
|
+
|
76
|
+
remove_basic_config () {
|
77
|
+
rm "${MURANO_CONFIGFILE}"
|
68
78
|
}
|
69
79
|
|
70
80
|
# Switch to the project directory and run tests.
|
71
81
|
|
72
82
|
prepare_to_test () {
|
73
|
-
cd
|
83
|
+
cd ${WORKSPACE}
|
74
84
|
|
75
85
|
# Instead of `rake test_clean_up -t`, call CLI directly with --no-color.
|
76
86
|
|
77
87
|
echo "Removing existing solutions from Murano account."
|
78
88
|
|
79
|
-
|
89
|
+
# We're not installing Murano CLI using gem, so we have to tell ruby
|
90
|
+
# where the library is.
|
91
|
+
export murano="ruby -I${WORKSPACE}/lib ${WORKSPACE}/bin/murano"
|
80
92
|
|
81
|
-
|
93
|
+
${murano} solutions expunge -y --no-progress --no-color --ascii
|
94
|
+
|
95
|
+
# Fix the PATH to avoid the error (on new Jenkins, dockerized test server):
|
82
96
|
#
|
83
97
|
# /tmp/jenkins8459777890102160498.sh: line 81: rspec: command not found
|
84
98
|
PATH=${PATH}:/usr/local/bundle/bin
|
@@ -86,15 +100,20 @@ prepare_to_test () {
|
|
86
100
|
# (lb): Sometimes the host drive directories mount as root:root with 2755
|
87
101
|
# permissions. But sometimes not. If it starts happening again, you'll see
|
88
102
|
# Errno::EACCES: Permission denied. Uncomment the sudoers code in Dockerfile.
|
89
|
-
|
90
|
-
|
103
|
+
if [[ -d /app ]]; then
|
104
|
+
sudo chmod 2777 /app/report
|
105
|
+
sudo chmod 2777 /app/coverage
|
106
|
+
else
|
107
|
+
mkdir ${WORKSPACE}/report
|
108
|
+
mkdir ${WORKSPACE}/coverage
|
109
|
+
fi
|
91
110
|
}
|
92
111
|
|
93
112
|
execute_tests () {
|
94
|
-
cd
|
113
|
+
cd ${WORKSPACE}
|
95
114
|
|
96
115
|
echo "############################################################################################"
|
97
|
-
echo "Testing \"$(murano -v)\" on \"$(ruby -v)\""
|
116
|
+
echo "Testing \"$(${murano} -v)\" on \"$(ruby -v)\""
|
98
117
|
echo "############################################################################################"
|
99
118
|
|
100
119
|
# Hint: Add `--example "<...>"` to limit the test suite.
|
@@ -105,30 +124,39 @@ execute_tests () {
|
|
105
124
|
|
106
125
|
rspec \
|
107
126
|
--format html \
|
108
|
-
--out /
|
109
|
-
--format documentation
|
127
|
+
--out ${WORKSPACE}/report/index-${RVERS}.html \
|
128
|
+
--format documentation \
|
129
|
+
"${@}"
|
110
130
|
|
111
131
|
rspec_rsp=$?
|
112
132
|
|
133
|
+
local retries=3
|
134
|
+
|
113
135
|
# BizAPI oftentimes timesout on a few tests, so try again.
|
114
|
-
|
136
|
+
while [[ ${rspec_rsp} -ne 0 && ${retries} -gt 0 ]]; do
|
137
|
+
echo -e "\n\nRetrying! ${retries} remain!!\n\n"
|
138
|
+
|
115
139
|
rspec \
|
116
140
|
--format html \
|
117
|
-
--out /
|
141
|
+
--out ${WORKSPACE}/report/index-${RVERS}.html \
|
118
142
|
--format documentation \
|
119
|
-
--only-failures
|
143
|
+
--only-failures \
|
144
|
+
"${@}"
|
120
145
|
|
121
146
|
rspec_rsp=$?
|
122
|
-
|
147
|
+
retries=$((${retries} - 1))
|
148
|
+
done
|
123
149
|
|
124
|
-
exit ${rspec_rsp}
|
150
|
+
#exit ${rspec_rsp}
|
151
|
+
echo -e "Thanks for flying the Murano CLIs!\n"
|
125
152
|
}
|
126
153
|
|
127
154
|
main () {
|
128
155
|
must_verify_environs
|
129
156
|
create_basic_config
|
130
157
|
prepare_to_test
|
131
|
-
execute_tests
|
158
|
+
execute_tests "${@}"
|
159
|
+
remove_basic_config
|
132
160
|
}
|
133
161
|
|
134
162
|
main "${@}"
|
@@ -74,7 +74,6 @@ function _murano () {
|
|
74
74
|
if [[ -z $cmd0 ]]; then
|
75
75
|
local -a comp_list
|
76
76
|
comp_list=(
|
77
|
-
_gb
|
78
77
|
_s
|
79
78
|
application
|
80
79
|
applications
|
@@ -82,6 +81,7 @@ function _murano () {
|
|
82
81
|
banner
|
83
82
|
business
|
84
83
|
businesses
|
84
|
+
child
|
85
85
|
completion
|
86
86
|
config
|
87
87
|
content
|
@@ -92,9 +92,9 @@ function _murano () {
|
|
92
92
|
devices
|
93
93
|
diff
|
94
94
|
domain
|
95
|
+
element
|
95
96
|
exchange
|
96
97
|
find
|
97
|
-
gwe
|
98
98
|
help
|
99
99
|
init
|
100
100
|
keystore
|
@@ -105,6 +105,7 @@ function _murano () {
|
|
105
105
|
logout
|
106
106
|
logs
|
107
107
|
mock
|
108
|
+
network
|
108
109
|
password
|
109
110
|
passwords
|
110
111
|
plugin
|
@@ -139,9 +140,6 @@ function _murano () {
|
|
139
140
|
COMPREPLY=($(compgen -W '${comp_list[@]}' -- "$last"))
|
140
141
|
else
|
141
142
|
case $cmd0 in
|
142
|
-
(_gb)
|
143
|
-
__murano-_gb "$cmd1" "$cmd2" "${used_switches[@]}"
|
144
|
-
;;
|
145
143
|
(_s)
|
146
144
|
__murano-_s "$cmd1" "$cmd2" "${used_switches[@]}"
|
147
145
|
;;
|
@@ -163,6 +161,9 @@ function _murano () {
|
|
163
161
|
(businesses)
|
164
162
|
__murano-businesses "$cmd1" "$cmd2" "${used_switches[@]}"
|
165
163
|
;;
|
164
|
+
(child)
|
165
|
+
__murano-child "$cmd1" "$cmd2" "${used_switches[@]}"
|
166
|
+
;;
|
166
167
|
(completion)
|
167
168
|
__murano-completion "$cmd1" "$cmd2" "${used_switches[@]}"
|
168
169
|
;;
|
@@ -193,15 +194,15 @@ function _murano () {
|
|
193
194
|
(domain)
|
194
195
|
__murano-domain "$cmd1" "$cmd2" "${used_switches[@]}"
|
195
196
|
;;
|
197
|
+
(element)
|
198
|
+
__murano-element "$cmd1" "$cmd2" "${used_switches[@]}"
|
199
|
+
;;
|
196
200
|
(exchange)
|
197
201
|
__murano-exchange "$cmd1" "$cmd2" "${used_switches[@]}"
|
198
202
|
;;
|
199
203
|
(find)
|
200
204
|
__murano-find "$cmd1" "$cmd2" "${used_switches[@]}"
|
201
205
|
;;
|
202
|
-
(gwe)
|
203
|
-
__murano-gwe "$cmd1" "$cmd2" "${used_switches[@]}"
|
204
|
-
;;
|
205
206
|
(help)
|
206
207
|
__murano-help "$cmd1" "$cmd2" "${used_switches[@]}"
|
207
208
|
;;
|
@@ -232,6 +233,9 @@ function _murano () {
|
|
232
233
|
(mock)
|
233
234
|
__murano-mock "$cmd1" "$cmd2" "${used_switches[@]}"
|
234
235
|
;;
|
236
|
+
(network)
|
237
|
+
__murano-network "$cmd1" "$cmd2" "${used_switches[@]}"
|
238
|
+
;;
|
235
239
|
(password)
|
236
240
|
__murano-password "$cmd1" "$cmd2" "${used_switches[@]}"
|
237
241
|
;;
|
@@ -305,60 +309,6 @@ function _murano () {
|
|
305
309
|
fi
|
306
310
|
}
|
307
311
|
|
308
|
-
# Completion for subcommand: "_gb".
|
309
|
-
function __murano-_gb () {
|
310
|
-
local subcmd1="$1"
|
311
|
-
local subcmd2="$2"
|
312
|
-
#local subcmdn="$3"
|
313
|
-
local used_switches="${@:3}"
|
314
|
-
local last="${COMP_WORDS[COMP_CWORD]}"
|
315
|
-
local len=$(($COMP_CWORD - 1))
|
316
|
-
|
317
|
-
local -a more_switches
|
318
|
-
|
319
|
-
local -a comp_list
|
320
|
-
|
321
|
-
#>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
|
322
|
-
#>&2 echo "used_switches=$used_switches"
|
323
|
-
#>&2 echo "more_switches=$more_switches"
|
324
|
-
|
325
|
-
# NOTE: Not doing anything special for ${subcmd2}.
|
326
|
-
# Are there sub-sub-commands we shoud list?
|
327
|
-
|
328
|
-
# Add unused application-wide flags.
|
329
|
-
local idx
|
330
|
-
for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
|
331
|
-
local switch=${__app_switches[$idx]}
|
332
|
-
if ! contains_element "$switch" "${used_switches[@]}"; then
|
333
|
-
comp_list+=("$switch")
|
334
|
-
fi
|
335
|
-
done
|
336
|
-
# Add unused subcommand flags.
|
337
|
-
for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
|
338
|
-
local switch=${more_switches[$idx]}
|
339
|
-
comp_list+=("$switch")
|
340
|
-
done
|
341
|
-
|
342
|
-
# If there are only --flags, <TAB> will put the common prefix,
|
343
|
-
# "--", but maybe the user doesn't want to add a flag after all.
|
344
|
-
if [[ -z ${last} ]]; then
|
345
|
-
local flags_only=true
|
346
|
-
for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
|
347
|
-
local switch=${comp_list[$idx]}
|
348
|
-
if [[ ${switch} != --* ]]; then
|
349
|
-
flags_only=false
|
350
|
-
break
|
351
|
-
fi
|
352
|
-
done
|
353
|
-
if ${flags_only}; then
|
354
|
-
# Use two Unicode en spaces to prevent compgen from prefixing "--".
|
355
|
-
comp_list+=(" ")
|
356
|
-
fi
|
357
|
-
fi
|
358
|
-
|
359
|
-
COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
|
360
|
-
}
|
361
|
-
|
362
312
|
# Completion for subcommand: "_s".
|
363
313
|
function __murano-_s () {
|
364
314
|
local subcmd1="$1"
|
@@ -896,6 +846,82 @@ function __murano-businesses () {
|
|
896
846
|
COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
|
897
847
|
}
|
898
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
|
+
|
899
925
|
# Completion for subcommand: "completion".
|
900
926
|
function __murano-completion () {
|
901
927
|
local subcmd1="$1"
|
@@ -1633,8 +1659,8 @@ function __murano-domain () {
|
|
1633
1659
|
COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
|
1634
1660
|
}
|
1635
1661
|
|
1636
|
-
# Completion for subcommand: "
|
1637
|
-
function __murano-
|
1662
|
+
# Completion for subcommand: "element".
|
1663
|
+
function __murano-element () {
|
1638
1664
|
local subcmd1="$1"
|
1639
1665
|
local subcmd2="$2"
|
1640
1666
|
#local subcmdn="$3"
|
@@ -1654,29 +1680,23 @@ function __murano-exchange () {
|
|
1654
1680
|
# Are there sub-sub-commands we shoud list?
|
1655
1681
|
if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
|
1656
1682
|
comp_list=(
|
1657
|
-
|
1658
|
-
|
1659
|
-
|
1660
|
-
purchase
|
1683
|
+
edit
|
1684
|
+
show
|
1685
|
+
update
|
1661
1686
|
)
|
1662
1687
|
else
|
1663
1688
|
case $subcmd1 in
|
1664
|
-
(
|
1689
|
+
(edit)
|
1665
1690
|
more_switches=(
|
1666
1691
|
{--trace}
|
1667
1692
|
)
|
1668
1693
|
;;
|
1669
|
-
(
|
1670
|
-
more_switches=(
|
1671
|
-
{--trace}
|
1672
|
-
)
|
1673
|
-
;;
|
1674
|
-
(list)
|
1694
|
+
(show)
|
1675
1695
|
more_switches=(
|
1676
1696
|
{--trace}
|
1677
1697
|
)
|
1678
1698
|
;;
|
1679
|
-
(
|
1699
|
+
(update)
|
1680
1700
|
more_switches=(
|
1681
1701
|
{--trace}
|
1682
1702
|
)
|
@@ -1718,8 +1738,8 @@ function __murano-exchange () {
|
|
1718
1738
|
COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
|
1719
1739
|
}
|
1720
1740
|
|
1721
|
-
# Completion for subcommand: "
|
1722
|
-
function __murano-
|
1741
|
+
# Completion for subcommand: "exchange".
|
1742
|
+
function __murano-exchange () {
|
1723
1743
|
local subcmd1="$1"
|
1724
1744
|
local subcmd2="$2"
|
1725
1745
|
#local subcmdn="$3"
|
@@ -1739,17 +1759,29 @@ function __murano-find () {
|
|
1739
1759
|
# Are there sub-sub-commands we shoud list?
|
1740
1760
|
if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
|
1741
1761
|
comp_list=(
|
1742
|
-
|
1743
|
-
|
1762
|
+
add
|
1763
|
+
buy
|
1764
|
+
list
|
1765
|
+
purchase
|
1744
1766
|
)
|
1745
1767
|
else
|
1746
1768
|
case $subcmd1 in
|
1747
|
-
(
|
1769
|
+
(add)
|
1748
1770
|
more_switches=(
|
1749
1771
|
{--trace}
|
1750
1772
|
)
|
1751
1773
|
;;
|
1752
|
-
(
|
1774
|
+
(buy)
|
1775
|
+
more_switches=(
|
1776
|
+
{--trace}
|
1777
|
+
)
|
1778
|
+
;;
|
1779
|
+
(list)
|
1780
|
+
more_switches=(
|
1781
|
+
{--trace}
|
1782
|
+
)
|
1783
|
+
;;
|
1784
|
+
(purchase)
|
1753
1785
|
more_switches=(
|
1754
1786
|
{--trace}
|
1755
1787
|
)
|
@@ -1791,8 +1823,8 @@ function __murano-find () {
|
|
1791
1823
|
COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
|
1792
1824
|
}
|
1793
1825
|
|
1794
|
-
# Completion for subcommand: "
|
1795
|
-
function __murano-
|
1826
|
+
# Completion for subcommand: "find".
|
1827
|
+
function __murano-find () {
|
1796
1828
|
local subcmd1="$1"
|
1797
1829
|
local subcmd2="$2"
|
1798
1830
|
#local subcmdn="$3"
|
@@ -1812,12 +1844,19 @@ function __murano-gwe () {
|
|
1812
1844
|
# Are there sub-sub-commands we shoud list?
|
1813
1845
|
if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
|
1814
1846
|
comp_list=(
|
1815
|
-
|
1847
|
+
application
|
1848
|
+
product
|
1816
1849
|
)
|
1817
1850
|
else
|
1818
1851
|
case $subcmd1 in
|
1819
|
-
(
|
1852
|
+
(application)
|
1853
|
+
more_switches=(
|
1854
|
+
{--trace}
|
1855
|
+
)
|
1856
|
+
;;
|
1857
|
+
(product)
|
1820
1858
|
more_switches=(
|
1859
|
+
{--trace}
|
1821
1860
|
)
|
1822
1861
|
;;
|
1823
1862
|
esac
|
@@ -2646,6 +2685,92 @@ function __murano-mock () {
|
|
2646
2685
|
COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
|
2647
2686
|
}
|
2648
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
|
+
|
2649
2774
|
# Completion for subcommand: "password".
|
2650
2775
|
function __murano-password () {
|
2651
2776
|
local subcmd1="$1"
|