MuranoCLI 3.2.0.beta.1 → 3.2.0.beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +4 -1
  3. data/.trustme.plugin +137 -0
  4. data/.trustme.sh +217 -117
  5. data/.trustme.vim +9 -3
  6. data/Gemfile +9 -3
  7. data/MuranoCLI.gemspec +8 -5
  8. data/Rakefile +1 -0
  9. data/dockers/Dockerfile.2.2.9 +6 -3
  10. data/dockers/Dockerfile.2.3.6 +6 -3
  11. data/dockers/Dockerfile.2.4.3 +6 -3
  12. data/dockers/Dockerfile.2.5.0 +6 -3
  13. data/dockers/Dockerfile.GemRelease +10 -8
  14. data/dockers/Dockerfile.m4 +23 -5
  15. data/dockers/docker-test.sh +65 -28
  16. data/docs/completions/murano_completion-bash +751 -57
  17. data/docs/develop.rst +10 -9
  18. data/lib/MrMurano/AccountBase.rb +95 -6
  19. data/lib/MrMurano/Commander-Entry.rb +9 -4
  20. data/lib/MrMurano/Config-Migrate.rb +2 -0
  21. data/lib/MrMurano/Config.rb +94 -26
  22. data/lib/MrMurano/Content.rb +1 -1
  23. data/lib/MrMurano/Exchange.rb +77 -42
  24. data/lib/MrMurano/Gateway.rb +1 -1
  25. data/lib/MrMurano/HttpAuthed.rb +20 -7
  26. data/lib/MrMurano/Logs.rb +10 -1
  27. data/lib/MrMurano/ProjectFile.rb +1 -1
  28. data/lib/MrMurano/ReCommander.rb +129 -73
  29. data/lib/MrMurano/Solution-ServiceConfig.rb +18 -11
  30. data/lib/MrMurano/Solution-Services.rb +78 -50
  31. data/lib/MrMurano/Solution-Users.rb +1 -1
  32. data/lib/MrMurano/Solution.rb +13 -63
  33. data/lib/MrMurano/SyncUpDown-Core.rb +185 -77
  34. data/lib/MrMurano/SyncUpDown-Item.rb +29 -4
  35. data/lib/MrMurano/SyncUpDown.rb +11 -11
  36. data/lib/MrMurano/Webservice-Cors.rb +1 -1
  37. data/lib/MrMurano/Webservice-Endpoint.rb +28 -17
  38. data/lib/MrMurano/Webservice-File.rb +103 -43
  39. data/lib/MrMurano/commands/domain.rb +1 -0
  40. data/lib/MrMurano/commands/element.rb +585 -0
  41. data/lib/MrMurano/commands/exchange.rb +211 -204
  42. data/lib/MrMurano/commands/gb.rb +1 -0
  43. data/lib/MrMurano/commands/globals.rb +17 -7
  44. data/lib/MrMurano/commands/init.rb +115 -101
  45. data/lib/MrMurano/commands/keystore.rb +1 -1
  46. data/lib/MrMurano/commands/logs.rb +2 -1
  47. data/lib/MrMurano/commands/postgresql.rb +17 -7
  48. data/lib/MrMurano/commands/service.rb +572 -0
  49. data/lib/MrMurano/commands/show.rb +7 -3
  50. data/lib/MrMurano/commands/solution.rb +2 -1
  51. data/lib/MrMurano/commands/solution_picker.rb +31 -15
  52. data/lib/MrMurano/commands/status.rb +205 -169
  53. data/lib/MrMurano/commands/sync.rb +70 -38
  54. data/lib/MrMurano/commands/token.rb +59 -14
  55. data/lib/MrMurano/commands/usage.rb +1 -0
  56. data/lib/MrMurano/commands.rb +2 -0
  57. data/lib/MrMurano/hash.rb +91 -0
  58. data/lib/MrMurano/http.rb +55 -6
  59. data/lib/MrMurano/makePretty.rb +47 -0
  60. data/lib/MrMurano/optparse.rb +60 -45
  61. data/lib/MrMurano/variegated/TruthyFalsey.rb +48 -0
  62. data/lib/MrMurano/variegated/ruby_dig.rb +64 -0
  63. data/lib/MrMurano/verbosing.rb +113 -3
  64. data/lib/MrMurano/version.rb +1 -1
  65. data/spec/Account_spec.rb +34 -20
  66. data/spec/Business_spec.rb +12 -9
  67. data/spec/Config_spec.rb +7 -1
  68. data/spec/Content_spec.rb +17 -1
  69. data/spec/GatewayBase_spec.rb +5 -2
  70. data/spec/GatewayDevice_spec.rb +4 -2
  71. data/spec/GatewayResource_spec.rb +4 -1
  72. data/spec/GatewaySettings_spec.rb +4 -1
  73. data/spec/HttpAuthed_spec.rb +73 -0
  74. data/spec/Http_spec.rb +32 -35
  75. data/spec/ProjectFile_spec.rb +1 -1
  76. data/spec/Solution-ServiceConfig_spec.rb +4 -1
  77. data/spec/Solution-ServiceEventHandler_spec.rb +6 -3
  78. data/spec/Solution-ServiceModules_spec.rb +4 -1
  79. data/spec/Solution-UsersRoles_spec.rb +4 -1
  80. data/spec/Solution_spec.rb +4 -1
  81. data/spec/SyncUpDown_spec.rb +1 -1
  82. data/spec/Webservice-Cors_spec.rb +4 -1
  83. data/spec/Webservice-Endpoint_spec.rb +9 -6
  84. data/spec/Webservice-File_spec.rb +17 -4
  85. data/spec/Webservice-Setting_spec.rb +6 -2
  86. data/spec/_workspace.rb +2 -0
  87. data/spec/cmd_common.rb +42 -13
  88. data/spec/cmd_content_spec.rb +17 -7
  89. data/spec/cmd_device_spec.rb +1 -1
  90. data/spec/cmd_domain_spec.rb +2 -2
  91. data/spec/cmd_element_spec.rb +400 -0
  92. data/spec/cmd_exchange_spec.rb +2 -2
  93. data/spec/cmd_init_spec.rb +59 -25
  94. data/spec/cmd_keystore_spec.rb +6 -3
  95. data/spec/cmd_link_spec.rb +10 -5
  96. data/spec/cmd_logs_spec.rb +1 -1
  97. data/spec/cmd_setting_application_spec.rb +18 -15
  98. data/spec/cmd_setting_product_spec.rb +7 -7
  99. data/spec/cmd_status_spec.rb +27 -17
  100. data/spec/cmd_syncdown_application_spec.rb +30 -3
  101. data/spec/cmd_syncdown_both_spec.rb +72 -18
  102. data/spec/cmd_syncup_spec.rb +71 -5
  103. data/spec/cmd_token_spec.rb +2 -2
  104. data/spec/cmd_usage_spec.rb +2 -2
  105. data/spec/dry_run_formatter.rb +27 -0
  106. data/spec/fixtures/dumped_config +8 -0
  107. data/spec/fixtures/exchange_element/element-show.json +1 -0
  108. data/spec/fixtures/exchange_element/swagger-mur-6407__10k.yaml +282 -0
  109. data/spec/fixtures/exchange_element/swagger-mur-6407__20k.yaml +588 -0
  110. data/spec/variegated_TruthyFalsey_spec.rb +29 -0
  111. metadata +51 -25
@@ -20,6 +20,13 @@ __app_switches=(
20
20
  --no-progress
21
21
  --no-ascii
22
22
  --verbose
23
+ --debug
24
+ --sid
25
+ --no-token
26
+ --no-basic
27
+ --no-login
28
+ --no-cache
29
+ --ttl
23
30
  --help
24
31
  --version
25
32
  --trace
@@ -67,9 +74,12 @@ function _murano () {
67
74
  if [[ -z $cmd0 ]]; then
68
75
  local -a comp_list
69
76
  comp_list=(
77
+ _gb
78
+ _s
70
79
  application
71
80
  applications
72
81
  assign
82
+ banner
73
83
  business
74
84
  businesses
75
85
  completion
@@ -97,11 +107,14 @@ function _murano () {
97
107
  mock
98
108
  password
99
109
  passwords
110
+ plugin
100
111
  postgresql
101
112
  product
102
113
  products
103
114
  pull
104
115
  push
116
+ service
117
+ services
105
118
  setting
106
119
  settings
107
120
  show
@@ -110,8 +123,11 @@ function _murano () {
110
123
  status
111
124
  syncdown
112
125
  syncup
126
+ token
127
+ tokens
113
128
  tsdb
114
129
  usage
130
+ whoami
115
131
  )
116
132
 
117
133
  for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
@@ -123,6 +139,12 @@ function _murano () {
123
139
  COMPREPLY=($(compgen -W '${comp_list[@]}' -- "$last"))
124
140
  else
125
141
  case $cmd0 in
142
+ (_gb)
143
+ __murano-_gb "$cmd1" "$cmd2" "${used_switches[@]}"
144
+ ;;
145
+ (_s)
146
+ __murano-_s "$cmd1" "$cmd2" "${used_switches[@]}"
147
+ ;;
126
148
  (application)
127
149
  __murano-application "$cmd1" "$cmd2" "${used_switches[@]}"
128
150
  ;;
@@ -132,6 +154,9 @@ function _murano () {
132
154
  (assign)
133
155
  __murano-assign "$cmd1" "$cmd2" "${used_switches[@]}"
134
156
  ;;
157
+ (banner)
158
+ __murano-banner "$cmd1" "$cmd2" "${used_switches[@]}"
159
+ ;;
135
160
  (business)
136
161
  __murano-business "$cmd1" "$cmd2" "${used_switches[@]}"
137
162
  ;;
@@ -213,6 +238,9 @@ function _murano () {
213
238
  (passwords)
214
239
  __murano-passwords "$cmd1" "$cmd2" "${used_switches[@]}"
215
240
  ;;
241
+ (plugin)
242
+ __murano-plugin "$cmd1" "$cmd2" "${used_switches[@]}"
243
+ ;;
216
244
  (postgresql)
217
245
  __murano-postgresql "$cmd1" "$cmd2" "${used_switches[@]}"
218
246
  ;;
@@ -228,6 +256,12 @@ function _murano () {
228
256
  (push)
229
257
  __murano-push "$cmd1" "$cmd2" "${used_switches[@]}"
230
258
  ;;
259
+ (service)
260
+ __murano-service "$cmd1" "$cmd2" "${used_switches[@]}"
261
+ ;;
262
+ (services)
263
+ __murano-services "$cmd1" "$cmd2" "${used_switches[@]}"
264
+ ;;
231
265
  (setting)
232
266
  __murano-setting "$cmd1" "$cmd2" "${used_switches[@]}"
233
267
  ;;
@@ -252,16 +286,155 @@ function _murano () {
252
286
  (syncup)
253
287
  __murano-syncup "$cmd1" "$cmd2" "${used_switches[@]}"
254
288
  ;;
289
+ (token)
290
+ __murano-token "$cmd1" "$cmd2" "${used_switches[@]}"
291
+ ;;
292
+ (tokens)
293
+ __murano-tokens "$cmd1" "$cmd2" "${used_switches[@]}"
294
+ ;;
255
295
  (tsdb)
256
296
  __murano-tsdb "$cmd1" "$cmd2" "${used_switches[@]}"
257
297
  ;;
258
298
  (usage)
259
299
  __murano-usage "$cmd1" "$cmd2" "${used_switches[@]}"
260
300
  ;;
301
+ (whoami)
302
+ __murano-whoami "$cmd1" "$cmd2" "${used_switches[@]}"
303
+ ;;
261
304
  esac
262
305
  fi
263
306
  }
264
307
 
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
+ # Completion for subcommand: "_s".
363
+ function __murano-_s () {
364
+ local subcmd1="$1"
365
+ local subcmd2="$2"
366
+ #local subcmdn="$3"
367
+ local used_switches="${@:3}"
368
+ local last="${COMP_WORDS[COMP_CWORD]}"
369
+ local len=$(($COMP_CWORD - 1))
370
+
371
+ local -a more_switches
372
+
373
+ local -a comp_list
374
+
375
+ #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
376
+ #>&2 echo "used_switches=$used_switches"
377
+ #>&2 echo "more_switches=$more_switches"
378
+
379
+ # NOTE: Not doing anything special for ${subcmd2}.
380
+ # Are there sub-sub-commands we shoud list?
381
+ if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
382
+ comp_list=(
383
+ dump
384
+ off
385
+ on
386
+ )
387
+ else
388
+ case $subcmd1 in
389
+ (dump)
390
+ more_switches=(
391
+ )
392
+ ;;
393
+ (off)
394
+ more_switches=(
395
+ )
396
+ ;;
397
+ (on)
398
+ more_switches=(
399
+ )
400
+ ;;
401
+ esac
402
+ fi
403
+
404
+ # Add unused application-wide flags.
405
+ local idx
406
+ for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
407
+ local switch=${__app_switches[$idx]}
408
+ if ! contains_element "$switch" "${used_switches[@]}"; then
409
+ comp_list+=("$switch")
410
+ fi
411
+ done
412
+ # Add unused subcommand flags.
413
+ for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
414
+ local switch=${more_switches[$idx]}
415
+ comp_list+=("$switch")
416
+ done
417
+
418
+ # If there are only --flags, <TAB> will put the common prefix,
419
+ # "--", but maybe the user doesn't want to add a flag after all.
420
+ if [[ -z ${last} ]]; then
421
+ local flags_only=true
422
+ for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
423
+ local switch=${comp_list[$idx]}
424
+ if [[ ${switch} != --* ]]; then
425
+ flags_only=false
426
+ break
427
+ fi
428
+ done
429
+ if ${flags_only}; then
430
+ # Use two Unicode en spaces to prevent compgen from prefixing "--".
431
+ comp_list+=("  ")
432
+ fi
433
+ fi
434
+
435
+ COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
436
+ }
437
+
265
438
  # Completion for subcommand: "application".
266
439
  function __murano-application () {
267
440
  local subcmd1="$1"
@@ -529,6 +702,60 @@ function __murano-assign () {
529
702
  COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
530
703
  }
531
704
 
705
+ # Completion for subcommand: "banner".
706
+ function __murano-banner () {
707
+ local subcmd1="$1"
708
+ local subcmd2="$2"
709
+ #local subcmdn="$3"
710
+ local used_switches="${@:3}"
711
+ local last="${COMP_WORDS[COMP_CWORD]}"
712
+ local len=$(($COMP_CWORD - 1))
713
+
714
+ local -a more_switches
715
+
716
+ local -a comp_list
717
+
718
+ #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
719
+ #>&2 echo "used_switches=$used_switches"
720
+ #>&2 echo "more_switches=$more_switches"
721
+
722
+ # NOTE: Not doing anything special for ${subcmd2}.
723
+ # Are there sub-sub-commands we shoud list?
724
+
725
+ # Add unused application-wide flags.
726
+ local idx
727
+ for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
728
+ local switch=${__app_switches[$idx]}
729
+ if ! contains_element "$switch" "${used_switches[@]}"; then
730
+ comp_list+=("$switch")
731
+ fi
732
+ done
733
+ # Add unused subcommand flags.
734
+ for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
735
+ local switch=${more_switches[$idx]}
736
+ comp_list+=("$switch")
737
+ done
738
+
739
+ # If there are only --flags, <TAB> will put the common prefix,
740
+ # "--", but maybe the user doesn't want to add a flag after all.
741
+ if [[ -z ${last} ]]; then
742
+ local flags_only=true
743
+ for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
744
+ local switch=${comp_list[$idx]}
745
+ if [[ ${switch} != --* ]]; then
746
+ flags_only=false
747
+ break
748
+ fi
749
+ done
750
+ if ${flags_only}; then
751
+ # Use two Unicode en spaces to prevent compgen from prefixing "--".
752
+ comp_list+=("  ")
753
+ fi
754
+ fi
755
+
756
+ COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
757
+ }
758
+
532
759
  # Completion for subcommand: "business".
533
760
  function __murano-business () {
534
761
  local subcmd1="$1"
@@ -2569,8 +2796,8 @@ function __murano-passwords () {
2569
2796
  COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
2570
2797
  }
2571
2798
 
2572
- # Completion for subcommand: "postgresql".
2573
- function __murano-postgresql () {
2799
+ # Completion for subcommand: "plugin".
2800
+ function __murano-plugin () {
2574
2801
  local subcmd1="$1"
2575
2802
  local subcmd2="$2"
2576
2803
  #local subcmdn="$3"
@@ -2590,15 +2817,35 @@ function __murano-postgresql () {
2590
2817
  # Are there sub-sub-commands we shoud list?
2591
2818
  if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
2592
2819
  comp_list=(
2593
- migrate
2820
+ install
2821
+ list
2822
+ registry
2823
+ remove
2824
+ source
2594
2825
  )
2595
2826
  else
2596
2827
  case $subcmd1 in
2597
- (migrate)
2828
+ (install)
2598
2829
  more_switches=(
2599
2830
  {--trace}
2600
2831
  )
2601
2832
  ;;
2833
+ (list)
2834
+ more_switches=(
2835
+ )
2836
+ ;;
2837
+ (registry)
2838
+ more_switches=(
2839
+ )
2840
+ ;;
2841
+ (remove)
2842
+ more_switches=(
2843
+ )
2844
+ ;;
2845
+ (source)
2846
+ more_switches=(
2847
+ )
2848
+ ;;
2602
2849
  esac
2603
2850
  fi
2604
2851
 
@@ -2636,8 +2883,8 @@ function __murano-postgresql () {
2636
2883
  COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
2637
2884
  }
2638
2885
 
2639
- # Completion for subcommand: "product".
2640
- function __murano-product () {
2886
+ # Completion for subcommand: "postgresql".
2887
+ function __murano-postgresql () {
2641
2888
  local subcmd1="$1"
2642
2889
  local subcmd2="$2"
2643
2890
  #local subcmdn="$3"
@@ -2657,60 +2904,127 @@ function __murano-product () {
2657
2904
  # Are there sub-sub-commands we shoud list?
2658
2905
  if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
2659
2906
  comp_list=(
2660
- create
2661
- delete
2662
- device
2663
- devices
2664
- diff
2665
- domain
2666
- find
2667
- list
2668
- logs
2669
- pull
2670
- push
2671
- usage
2907
+ migrate
2672
2908
  )
2673
2909
  else
2674
2910
  case $subcmd1 in
2675
- (create)
2676
- more_switches=(
2677
- {--trace}
2678
- )
2679
- ;;
2680
- (delete)
2681
- more_switches=(
2682
- {--trace}
2683
- )
2684
- ;;
2685
- (device)
2686
- more_switches=(
2687
- )
2688
- ;;
2689
- (devices)
2690
- more_switches=(
2691
- )
2692
- ;;
2693
- (diff)
2694
- more_switches=(
2695
- {--trace}
2696
- )
2697
- ;;
2698
- (domain)
2699
- more_switches=(
2700
- {--trace}
2701
- )
2702
- ;;
2703
- (find)
2704
- more_switches=(
2705
- {--trace}
2706
- )
2707
- ;;
2708
- (list)
2709
- more_switches=(
2710
- {--trace}
2711
- )
2712
- ;;
2713
- (logs)
2911
+ (migrate)
2912
+ more_switches=(
2913
+ {--trace}
2914
+ )
2915
+ ;;
2916
+ esac
2917
+ fi
2918
+
2919
+ # Add unused application-wide flags.
2920
+ local idx
2921
+ for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
2922
+ local switch=${__app_switches[$idx]}
2923
+ if ! contains_element "$switch" "${used_switches[@]}"; then
2924
+ comp_list+=("$switch")
2925
+ fi
2926
+ done
2927
+ # Add unused subcommand flags.
2928
+ for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
2929
+ local switch=${more_switches[$idx]}
2930
+ comp_list+=("$switch")
2931
+ done
2932
+
2933
+ # If there are only --flags, <TAB> will put the common prefix,
2934
+ # "--", but maybe the user doesn't want to add a flag after all.
2935
+ if [[ -z ${last} ]]; then
2936
+ local flags_only=true
2937
+ for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
2938
+ local switch=${comp_list[$idx]}
2939
+ if [[ ${switch} != --* ]]; then
2940
+ flags_only=false
2941
+ break
2942
+ fi
2943
+ done
2944
+ if ${flags_only}; then
2945
+ # Use two Unicode en spaces to prevent compgen from prefixing "--".
2946
+ comp_list+=("  ")
2947
+ fi
2948
+ fi
2949
+
2950
+ COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
2951
+ }
2952
+
2953
+ # Completion for subcommand: "product".
2954
+ function __murano-product () {
2955
+ local subcmd1="$1"
2956
+ local subcmd2="$2"
2957
+ #local subcmdn="$3"
2958
+ local used_switches="${@:3}"
2959
+ local last="${COMP_WORDS[COMP_CWORD]}"
2960
+ local len=$(($COMP_CWORD - 1))
2961
+
2962
+ local -a more_switches
2963
+
2964
+ local -a comp_list
2965
+
2966
+ #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
2967
+ #>&2 echo "used_switches=$used_switches"
2968
+ #>&2 echo "more_switches=$more_switches"
2969
+
2970
+ # NOTE: Not doing anything special for ${subcmd2}.
2971
+ # Are there sub-sub-commands we shoud list?
2972
+ if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
2973
+ comp_list=(
2974
+ create
2975
+ delete
2976
+ device
2977
+ devices
2978
+ diff
2979
+ domain
2980
+ find
2981
+ list
2982
+ logs
2983
+ pull
2984
+ push
2985
+ usage
2986
+ )
2987
+ else
2988
+ case $subcmd1 in
2989
+ (create)
2990
+ more_switches=(
2991
+ {--trace}
2992
+ )
2993
+ ;;
2994
+ (delete)
2995
+ more_switches=(
2996
+ {--trace}
2997
+ )
2998
+ ;;
2999
+ (device)
3000
+ more_switches=(
3001
+ )
3002
+ ;;
3003
+ (devices)
3004
+ more_switches=(
3005
+ )
3006
+ ;;
3007
+ (diff)
3008
+ more_switches=(
3009
+ {--trace}
3010
+ )
3011
+ ;;
3012
+ (domain)
3013
+ more_switches=(
3014
+ {--trace}
3015
+ )
3016
+ ;;
3017
+ (find)
3018
+ more_switches=(
3019
+ {--trace}
3020
+ )
3021
+ ;;
3022
+ (list)
3023
+ more_switches=(
3024
+ {--trace}
3025
+ )
3026
+ ;;
3027
+ (logs)
2714
3028
  more_switches=(
2715
3029
  {--trace}
2716
3030
  )
@@ -2980,6 +3294,176 @@ function __murano-push () {
2980
3294
  COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
2981
3295
  }
2982
3296
 
3297
+ # Completion for subcommand: "service".
3298
+ function __murano-service () {
3299
+ local subcmd1="$1"
3300
+ local subcmd2="$2"
3301
+ #local subcmdn="$3"
3302
+ local used_switches="${@:3}"
3303
+ local last="${COMP_WORDS[COMP_CWORD]}"
3304
+ local len=$(($COMP_CWORD - 1))
3305
+
3306
+ local -a more_switches
3307
+
3308
+ local -a comp_list
3309
+
3310
+ #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
3311
+ #>&2 echo "used_switches=$used_switches"
3312
+ #>&2 echo "more_switches=$more_switches"
3313
+
3314
+ # NOTE: Not doing anything special for ${subcmd2}.
3315
+ # Are there sub-sub-commands we shoud list?
3316
+ if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
3317
+ comp_list=(
3318
+ add
3319
+ create
3320
+ delete
3321
+ get
3322
+ list
3323
+ remove
3324
+ status
3325
+ )
3326
+ else
3327
+ case $subcmd1 in
3328
+ (add)
3329
+ more_switches=(
3330
+ {--trace}
3331
+ )
3332
+ ;;
3333
+ (create)
3334
+ more_switches=(
3335
+ {--trace}
3336
+ )
3337
+ ;;
3338
+ (delete)
3339
+ more_switches=(
3340
+ {--trace}
3341
+ )
3342
+ ;;
3343
+ (get)
3344
+ more_switches=(
3345
+ {--trace}
3346
+ )
3347
+ ;;
3348
+ (list)
3349
+ more_switches=(
3350
+ {--trace}
3351
+ )
3352
+ ;;
3353
+ (remove)
3354
+ more_switches=(
3355
+ {--trace}
3356
+ )
3357
+ ;;
3358
+ (status)
3359
+ more_switches=(
3360
+ {--trace}
3361
+ )
3362
+ ;;
3363
+ esac
3364
+ fi
3365
+
3366
+ # Add unused application-wide flags.
3367
+ local idx
3368
+ for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
3369
+ local switch=${__app_switches[$idx]}
3370
+ if ! contains_element "$switch" "${used_switches[@]}"; then
3371
+ comp_list+=("$switch")
3372
+ fi
3373
+ done
3374
+ # Add unused subcommand flags.
3375
+ for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
3376
+ local switch=${more_switches[$idx]}
3377
+ comp_list+=("$switch")
3378
+ done
3379
+
3380
+ # If there are only --flags, <TAB> will put the common prefix,
3381
+ # "--", but maybe the user doesn't want to add a flag after all.
3382
+ if [[ -z ${last} ]]; then
3383
+ local flags_only=true
3384
+ for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
3385
+ local switch=${comp_list[$idx]}
3386
+ if [[ ${switch} != --* ]]; then
3387
+ flags_only=false
3388
+ break
3389
+ fi
3390
+ done
3391
+ if ${flags_only}; then
3392
+ # Use two Unicode en spaces to prevent compgen from prefixing "--".
3393
+ comp_list+=("  ")
3394
+ fi
3395
+ fi
3396
+
3397
+ COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
3398
+ }
3399
+
3400
+ # Completion for subcommand: "services".
3401
+ function __murano-services () {
3402
+ local subcmd1="$1"
3403
+ local subcmd2="$2"
3404
+ #local subcmdn="$3"
3405
+ local used_switches="${@:3}"
3406
+ local last="${COMP_WORDS[COMP_CWORD]}"
3407
+ local len=$(($COMP_CWORD - 1))
3408
+
3409
+ local -a more_switches
3410
+
3411
+ local -a comp_list
3412
+
3413
+ #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
3414
+ #>&2 echo "used_switches=$used_switches"
3415
+ #>&2 echo "more_switches=$more_switches"
3416
+
3417
+ # NOTE: Not doing anything special for ${subcmd2}.
3418
+ # Are there sub-sub-commands we shoud list?
3419
+ if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
3420
+ comp_list=(
3421
+ list
3422
+ )
3423
+ else
3424
+ case $subcmd1 in
3425
+ (list)
3426
+ more_switches=(
3427
+ {--trace}
3428
+ )
3429
+ ;;
3430
+ esac
3431
+ fi
3432
+
3433
+ # Add unused application-wide flags.
3434
+ local idx
3435
+ for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
3436
+ local switch=${__app_switches[$idx]}
3437
+ if ! contains_element "$switch" "${used_switches[@]}"; then
3438
+ comp_list+=("$switch")
3439
+ fi
3440
+ done
3441
+ # Add unused subcommand flags.
3442
+ for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
3443
+ local switch=${more_switches[$idx]}
3444
+ comp_list+=("$switch")
3445
+ done
3446
+
3447
+ # If there are only --flags, <TAB> will put the common prefix,
3448
+ # "--", but maybe the user doesn't want to add a flag after all.
3449
+ if [[ -z ${last} ]]; then
3450
+ local flags_only=true
3451
+ for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
3452
+ local switch=${comp_list[$idx]}
3453
+ if [[ ${switch} != --* ]]; then
3454
+ flags_only=false
3455
+ break
3456
+ fi
3457
+ done
3458
+ if ${flags_only}; then
3459
+ # Use two Unicode en spaces to prevent compgen from prefixing "--".
3460
+ comp_list+=("  ")
3461
+ fi
3462
+ fi
3463
+
3464
+ COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
3465
+ }
3466
+
2983
3467
  # Completion for subcommand: "setting".
2984
3468
  function __murano-setting () {
2985
3469
  local subcmd1="$1"
@@ -3510,6 +3994,162 @@ function __murano-syncup () {
3510
3994
  COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
3511
3995
  }
3512
3996
 
3997
+ # Completion for subcommand: "token".
3998
+ function __murano-token () {
3999
+ local subcmd1="$1"
4000
+ local subcmd2="$2"
4001
+ #local subcmdn="$3"
4002
+ local used_switches="${@:3}"
4003
+ local last="${COMP_WORDS[COMP_CWORD]}"
4004
+ local len=$(($COMP_CWORD - 1))
4005
+
4006
+ local -a more_switches
4007
+
4008
+ local -a comp_list
4009
+
4010
+ #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
4011
+ #>&2 echo "used_switches=$used_switches"
4012
+ #>&2 echo "more_switches=$more_switches"
4013
+
4014
+ # NOTE: Not doing anything special for ${subcmd2}.
4015
+ # Are there sub-sub-commands we shoud list?
4016
+ if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
4017
+ comp_list=(
4018
+ delete
4019
+ fetch
4020
+ get
4021
+ list
4022
+ set
4023
+ )
4024
+ else
4025
+ case $subcmd1 in
4026
+ (delete)
4027
+ more_switches=(
4028
+ {--trace}
4029
+ )
4030
+ ;;
4031
+ (fetch)
4032
+ more_switches=(
4033
+ {--trace}
4034
+ )
4035
+ ;;
4036
+ (get)
4037
+ more_switches=(
4038
+ {--trace}
4039
+ )
4040
+ ;;
4041
+ (list)
4042
+ more_switches=(
4043
+ )
4044
+ ;;
4045
+ (set)
4046
+ more_switches=(
4047
+ {--trace}
4048
+ )
4049
+ ;;
4050
+ esac
4051
+ fi
4052
+
4053
+ # Add unused application-wide flags.
4054
+ local idx
4055
+ for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
4056
+ local switch=${__app_switches[$idx]}
4057
+ if ! contains_element "$switch" "${used_switches[@]}"; then
4058
+ comp_list+=("$switch")
4059
+ fi
4060
+ done
4061
+ # Add unused subcommand flags.
4062
+ for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
4063
+ local switch=${more_switches[$idx]}
4064
+ comp_list+=("$switch")
4065
+ done
4066
+
4067
+ # If there are only --flags, <TAB> will put the common prefix,
4068
+ # "--", but maybe the user doesn't want to add a flag after all.
4069
+ if [[ -z ${last} ]]; then
4070
+ local flags_only=true
4071
+ for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
4072
+ local switch=${comp_list[$idx]}
4073
+ if [[ ${switch} != --* ]]; then
4074
+ flags_only=false
4075
+ break
4076
+ fi
4077
+ done
4078
+ if ${flags_only}; then
4079
+ # Use two Unicode en spaces to prevent compgen from prefixing "--".
4080
+ comp_list+=("  ")
4081
+ fi
4082
+ fi
4083
+
4084
+ COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
4085
+ }
4086
+
4087
+ # Completion for subcommand: "tokens".
4088
+ function __murano-tokens () {
4089
+ local subcmd1="$1"
4090
+ local subcmd2="$2"
4091
+ #local subcmdn="$3"
4092
+ local used_switches="${@:3}"
4093
+ local last="${COMP_WORDS[COMP_CWORD]}"
4094
+ local len=$(($COMP_CWORD - 1))
4095
+
4096
+ local -a more_switches
4097
+
4098
+ local -a comp_list
4099
+
4100
+ #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
4101
+ #>&2 echo "used_switches=$used_switches"
4102
+ #>&2 echo "more_switches=$more_switches"
4103
+
4104
+ # NOTE: Not doing anything special for ${subcmd2}.
4105
+ # Are there sub-sub-commands we shoud list?
4106
+ if [[ -z ${subcmd1} || ${len} -eq 1 ]]; then
4107
+ comp_list=(
4108
+ list
4109
+ )
4110
+ else
4111
+ case $subcmd1 in
4112
+ (list)
4113
+ more_switches=(
4114
+ )
4115
+ ;;
4116
+ esac
4117
+ fi
4118
+
4119
+ # Add unused application-wide flags.
4120
+ local idx
4121
+ for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
4122
+ local switch=${__app_switches[$idx]}
4123
+ if ! contains_element "$switch" "${used_switches[@]}"; then
4124
+ comp_list+=("$switch")
4125
+ fi
4126
+ done
4127
+ # Add unused subcommand flags.
4128
+ for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
4129
+ local switch=${more_switches[$idx]}
4130
+ comp_list+=("$switch")
4131
+ done
4132
+
4133
+ # If there are only --flags, <TAB> will put the common prefix,
4134
+ # "--", but maybe the user doesn't want to add a flag after all.
4135
+ if [[ -z ${last} ]]; then
4136
+ local flags_only=true
4137
+ for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
4138
+ local switch=${comp_list[$idx]}
4139
+ if [[ ${switch} != --* ]]; then
4140
+ flags_only=false
4141
+ break
4142
+ fi
4143
+ done
4144
+ if ${flags_only}; then
4145
+ # Use two Unicode en spaces to prevent compgen from prefixing "--".
4146
+ comp_list+=("  ")
4147
+ fi
4148
+ fi
4149
+
4150
+ COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
4151
+ }
4152
+
3513
4153
  # Completion for subcommand: "tsdb".
3514
4154
  function __murano-tsdb () {
3515
4155
  local subcmd1="$1"
@@ -3661,5 +4301,59 @@ function __murano-usage () {
3661
4301
  COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
3662
4302
  }
3663
4303
 
4304
+ # Completion for subcommand: "whoami".
4305
+ function __murano-whoami () {
4306
+ local subcmd1="$1"
4307
+ local subcmd2="$2"
4308
+ #local subcmdn="$3"
4309
+ local used_switches="${@:3}"
4310
+ local last="${COMP_WORDS[COMP_CWORD]}"
4311
+ local len=$(($COMP_CWORD - 1))
4312
+
4313
+ local -a more_switches
4314
+
4315
+ local -a comp_list
4316
+
4317
+ #>&2 echo -e "\nsubcmd1=$subcmd1 / subcmd2=$subcmd2 / last=$last / len=$len"
4318
+ #>&2 echo "used_switches=$used_switches"
4319
+ #>&2 echo "more_switches=$more_switches"
4320
+
4321
+ # NOTE: Not doing anything special for ${subcmd2}.
4322
+ # Are there sub-sub-commands we shoud list?
4323
+
4324
+ # Add unused application-wide flags.
4325
+ local idx
4326
+ for ((idx = 0; idx < ${#__app_switches[@]}; idx++)); do
4327
+ local switch=${__app_switches[$idx]}
4328
+ if ! contains_element "$switch" "${used_switches[@]}"; then
4329
+ comp_list+=("$switch")
4330
+ fi
4331
+ done
4332
+ # Add unused subcommand flags.
4333
+ for ((idx = 0; idx < ${#more_switches[@]}; idx++)); do
4334
+ local switch=${more_switches[$idx]}
4335
+ comp_list+=("$switch")
4336
+ done
4337
+
4338
+ # If there are only --flags, <TAB> will put the common prefix,
4339
+ # "--", but maybe the user doesn't want to add a flag after all.
4340
+ if [[ -z ${last} ]]; then
4341
+ local flags_only=true
4342
+ for ((idx = 0; idx < ${#comp_list[@]}; idx++)); do
4343
+ local switch=${comp_list[$idx]}
4344
+ if [[ ${switch} != --* ]]; then
4345
+ flags_only=false
4346
+ break
4347
+ fi
4348
+ done
4349
+ if ${flags_only}; then
4350
+ # Use two Unicode en spaces to prevent compgen from prefixing "--".
4351
+ comp_list+=("  ")
4352
+ fi
4353
+ fi
4354
+
4355
+ COMPREPLY=($(compgen -W '${comp_list[@]}' -- "${last}"))
4356
+ }
4357
+
3664
4358
  complete -F _murano murano
3665
4359