brightbox-cli 1.2.2 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (245) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +26 -0
  3. data/Gemfile +0 -2
  4. data/Gemfile.lock +25 -23
  5. data/Rakefile +1 -1
  6. data/bin/_brightbox-bash-completer +327 -328
  7. data/bin/brightbox +2 -2
  8. data/bin/brightbox-accounts +2 -2
  9. data/bin/brightbox-cloudips +2 -2
  10. data/bin/brightbox-config +2 -2
  11. data/bin/brightbox-firewall-policies +2 -2
  12. data/bin/brightbox-firewall-rules +2 -2
  13. data/bin/brightbox-groups +2 -2
  14. data/bin/brightbox-images +2 -2
  15. data/bin/brightbox-lbs +2 -2
  16. data/bin/brightbox-servers +2 -2
  17. data/bin/brightbox-types +2 -2
  18. data/bin/brightbox-users +2 -2
  19. data/bin/brightbox-zones +2 -2
  20. data/brightbox-cli.gemspec +14 -15
  21. data/lib/brightbox-cli/api.rb +4 -6
  22. data/lib/brightbox-cli/collaboration.rb +1 -3
  23. data/lib/brightbox-cli/commands/accounts/accept-invite.rb +1 -1
  24. data/lib/brightbox-cli/commands/accounts/default.rb +1 -1
  25. data/lib/brightbox-cli/commands/accounts/list.rb +1 -1
  26. data/lib/brightbox-cli/commands/accounts/remove.rb +1 -1
  27. data/lib/brightbox-cli/commands/accounts/reset-ftp-password.rb +1 -1
  28. data/lib/brightbox-cli/commands/accounts/show.rb +1 -1
  29. data/lib/brightbox-cli/commands/cloudips/create.rb +1 -1
  30. data/lib/brightbox-cli/commands/cloudips/destroy.rb +1 -1
  31. data/lib/brightbox-cli/commands/cloudips/list.rb +1 -1
  32. data/lib/brightbox-cli/commands/cloudips/show.rb +1 -1
  33. data/lib/brightbox-cli/commands/cloudips/unmap.rb +1 -1
  34. data/lib/brightbox-cli/commands/collaborations.rb +4 -4
  35. data/lib/brightbox-cli/commands/config/client-add.rb +1 -1
  36. data/lib/brightbox-cli/commands/config/client-default.rb +1 -1
  37. data/lib/brightbox-cli/commands/config/client-list.rb +1 -1
  38. data/lib/brightbox-cli/commands/config/client-remove.rb +1 -1
  39. data/lib/brightbox-cli/commands/config/user-add.rb +1 -1
  40. data/lib/brightbox-cli/commands/firewall/policies-destroy.rb +1 -1
  41. data/lib/brightbox-cli/commands/firewall/policies-list.rb +1 -1
  42. data/lib/brightbox-cli/commands/firewall/policies-show.rb +1 -1
  43. data/lib/brightbox-cli/commands/firewall/rules-destroy.rb +1 -1
  44. data/lib/brightbox-cli/commands/firewall/rules-list.rb +1 -1
  45. data/lib/brightbox-cli/commands/firewall/rules-show.rb +1 -1
  46. data/lib/brightbox-cli/commands/groups/add-server.rb +1 -1
  47. data/lib/brightbox-cli/commands/groups/create.rb +1 -1
  48. data/lib/brightbox-cli/commands/groups/destroy.rb +1 -1
  49. data/lib/brightbox-cli/commands/groups/list.rb +1 -1
  50. data/lib/brightbox-cli/commands/groups/show.rb +1 -1
  51. data/lib/brightbox-cli/commands/images/destroy.rb +1 -1
  52. data/lib/brightbox-cli/commands/images/locking.rb +37 -0
  53. data/lib/brightbox-cli/commands/images/register.rb +1 -1
  54. data/lib/brightbox-cli/commands/images/show.rb +18 -4
  55. data/lib/brightbox-cli/commands/lbs/add-nodes.rb +1 -1
  56. data/lib/brightbox-cli/commands/lbs/destroy.rb +1 -1
  57. data/lib/brightbox-cli/commands/lbs/list.rb +1 -1
  58. data/lib/brightbox-cli/commands/lbs/locking.rb +37 -0
  59. data/lib/brightbox-cli/commands/lbs/remove-nodes.rb +1 -1
  60. data/lib/brightbox-cli/commands/lbs/show.rb +3 -2
  61. data/lib/brightbox-cli/commands/servers/activate-console.rb +1 -1
  62. data/lib/brightbox-cli/commands/servers/destroy.rb +1 -1
  63. data/lib/brightbox-cli/commands/servers/locking.rb +37 -0
  64. data/lib/brightbox-cli/commands/servers/reboot.rb +20 -0
  65. data/lib/brightbox-cli/commands/servers/reset.rb +20 -0
  66. data/lib/brightbox-cli/commands/servers/show.rb +1 -1
  67. data/lib/brightbox-cli/commands/servers/shutdown.rb +1 -1
  68. data/lib/brightbox-cli/commands/servers/snapshot.rb +1 -1
  69. data/lib/brightbox-cli/commands/servers/start.rb +1 -1
  70. data/lib/brightbox-cli/commands/servers/stop.rb +1 -1
  71. data/lib/brightbox-cli/commands/sql/instances_create.rb +1 -1
  72. data/lib/brightbox-cli/commands/sql/instances_destroy.rb +1 -1
  73. data/lib/brightbox-cli/commands/sql/instances_list.rb +1 -1
  74. data/lib/brightbox-cli/commands/sql/instances_locking.rb +39 -0
  75. data/lib/brightbox-cli/commands/sql/instances_reset_password.rb +1 -1
  76. data/lib/brightbox-cli/commands/sql/instances_show.rb +1 -1
  77. data/lib/brightbox-cli/commands/sql/instances_snapshot.rb +1 -1
  78. data/lib/brightbox-cli/commands/sql/snapshots_destroy.rb +1 -1
  79. data/lib/brightbox-cli/commands/sql/snapshots_list.rb +1 -1
  80. data/lib/brightbox-cli/commands/sql/snapshots_locking.rb +39 -0
  81. data/lib/brightbox-cli/commands/sql/snapshots_show.rb +9 -2
  82. data/lib/brightbox-cli/commands/sql/types.rb +2 -2
  83. data/lib/brightbox-cli/commands/types.rb +2 -2
  84. data/lib/brightbox-cli/commands/user-collaborations.rb +2 -2
  85. data/lib/brightbox-cli/commands/users/list.rb +1 -1
  86. data/lib/brightbox-cli/commands/users/show.rb +1 -1
  87. data/lib/brightbox-cli/commands/zones.rb +1 -1
  88. data/lib/brightbox-cli/config/accounts.rb +1 -1
  89. data/lib/brightbox-cli/config/api_client.rb +3 -3
  90. data/lib/brightbox-cli/config/authentication_tokens.rb +2 -2
  91. data/lib/brightbox-cli/config/cache.rb +1 -1
  92. data/lib/brightbox-cli/config/dirty.rb +1 -1
  93. data/lib/brightbox-cli/config/user_application.rb +3 -3
  94. data/lib/brightbox-cli/config.rb +2 -2
  95. data/lib/brightbox-cli/database_server.rb +2 -1
  96. data/lib/brightbox-cli/database_snapshot.rb +1 -0
  97. data/lib/brightbox-cli/detailed_server.rb +1 -0
  98. data/lib/brightbox-cli/gli_global_hooks.rb +2 -2
  99. data/lib/brightbox-cli/images.rb +2 -1
  100. data/lib/brightbox-cli/legacy/args_adjuster.rb +3 -3
  101. data/lib/brightbox-cli/load_balancers.rb +1 -0
  102. data/lib/brightbox-cli/servers.rb +2 -1
  103. data/lib/brightbox-cli/user_collaboration.rb +1 -1
  104. data/lib/brightbox-cli/version.rb +1 -1
  105. data/lib/brightbox_cli.rb +3 -3
  106. data/locales/en.yml +24 -0
  107. data/spec/commands/accounts/default_spec.rb +2 -2
  108. data/spec/commands/accounts/list_spec.rb +7 -7
  109. data/spec/commands/accounts/reset_ftp_password_spec.rb +2 -2
  110. data/spec/commands/accounts/show_spec.rb +2 -2
  111. data/spec/commands/cloudips/create_spec.rb +2 -2
  112. data/spec/commands/cloudips/destroy_spec.rb +2 -2
  113. data/spec/commands/cloudips/list_spec.rb +2 -2
  114. data/spec/commands/cloudips/map_spec.rb +3 -3
  115. data/spec/commands/cloudips/show_spec.rb +2 -2
  116. data/spec/commands/cloudips/unmap_spec.rb +2 -2
  117. data/spec/commands/cloudips/update_spec.rb +2 -2
  118. data/spec/commands/config/client_add_spec.rb +2 -2
  119. data/spec/commands/config/client_default_spec.rb +2 -2
  120. data/spec/commands/config/client_list_spec.rb +2 -2
  121. data/spec/commands/config/client_remove_spec.rb +2 -2
  122. data/spec/commands/config/user_add_spec.rb +3 -6
  123. data/spec/commands/firewall_policies/update_spec.rb +7 -7
  124. data/spec/commands/groups/add_server_spec.rb +2 -2
  125. data/spec/commands/groups/create_spec.rb +2 -2
  126. data/spec/commands/groups/destroy_spec.rb +2 -2
  127. data/spec/commands/groups/list_spec.rb +2 -2
  128. data/spec/commands/groups/move_servers_spec.rb +2 -2
  129. data/spec/commands/groups/remove_servers_spec.rb +2 -2
  130. data/spec/commands/groups/show_spec.rb +2 -2
  131. data/spec/commands/groups/update_spec.rb +2 -2
  132. data/spec/commands/images/destroy_spec.rb +2 -2
  133. data/spec/commands/images/list_spec.rb +2 -2
  134. data/spec/commands/images/locking_spec.rb +73 -0
  135. data/spec/commands/images/register_spec.rb +2 -2
  136. data/spec/commands/images/show_spec.rb +2 -2
  137. data/spec/commands/images/update_spec.rb +2 -2
  138. data/spec/commands/lbs/add_nodes_spec.rb +2 -2
  139. data/spec/commands/lbs/create_spec.rb +2 -2
  140. data/spec/commands/lbs/destroy_spec.rb +2 -2
  141. data/spec/commands/lbs/list_spec.rb +2 -2
  142. data/spec/commands/lbs/locking_spec.rb +73 -0
  143. data/spec/commands/lbs/remove_nodes_spec.rb +2 -2
  144. data/spec/commands/lbs/show_spec.rb +2 -2
  145. data/spec/commands/lbs/update_spec.rb +2 -2
  146. data/spec/commands/policies/apply_spec.rb +2 -2
  147. data/spec/commands/policies/create_spec.rb +2 -2
  148. data/spec/commands/policies/destroy_spec.rb +2 -2
  149. data/spec/commands/policies/list_spec.rb +2 -2
  150. data/spec/commands/policies/remove_spec.rb +2 -2
  151. data/spec/commands/policies/show_spec.rb +2 -2
  152. data/spec/commands/policies/update_spec.rb +2 -2
  153. data/spec/commands/rules/create_spec.rb +2 -2
  154. data/spec/commands/rules/destroy_spec.rb +2 -2
  155. data/spec/commands/rules/list_spec.rb +2 -2
  156. data/spec/commands/rules/show_spec.rb +2 -2
  157. data/spec/commands/rules/update_spec.rb +2 -2
  158. data/spec/commands/servers/activate_console_spec.rb +2 -2
  159. data/spec/commands/servers/create_spec.rb +2 -2
  160. data/spec/commands/servers/destroy_spec.rb +2 -2
  161. data/spec/commands/servers/list_spec.rb +2 -2
  162. data/spec/commands/servers/locking_spec.rb +73 -0
  163. data/spec/commands/servers/reboot_spec.rb +55 -0
  164. data/spec/commands/servers/reset_spec.rb +55 -0
  165. data/spec/commands/servers/show_spec.rb +2 -2
  166. data/spec/commands/servers/shutdown_spec.rb +2 -2
  167. data/spec/commands/servers/snapshot_spec.rb +2 -2
  168. data/spec/commands/servers/start_spec.rb +2 -2
  169. data/spec/commands/servers/stop_spec.rb +2 -2
  170. data/spec/commands/servers/update_spec.rb +2 -2
  171. data/spec/commands/sql/instances/create_spec.rb +4 -4
  172. data/spec/commands/sql/instances/locking_spec.rb +73 -0
  173. data/spec/commands/sql/instances/snapshot_spec.rb +2 -2
  174. data/spec/commands/sql/snapshots/list_spec.rb +1 -1
  175. data/spec/commands/sql/snapshots/locking_spec.rb +73 -0
  176. data/spec/commands/sql/snapshots/show_spec.rb +1 -1
  177. data/spec/commands/sql/types/list_spec.rb +1 -1
  178. data/spec/commands/types/list_spec.rb +2 -2
  179. data/spec/commands/users/list_spec.rb +2 -2
  180. data/spec/commands/users/show_spec.rb +2 -2
  181. data/spec/commands/users/update_spec.rb +2 -2
  182. data/spec/commands/zones/list_spec.rb +2 -2
  183. data/spec/spec_helper.rb +8 -9
  184. data/spec/support/common_helpers.rb +10 -10
  185. data/spec/support/config_helpers.rb +0 -1
  186. data/spec/support/faux_io.rb +10 -14
  187. data/spec/support/password_prompt_helpers.rb +1 -2
  188. data/spec/support/server_helper.rb +1 -1
  189. data/spec/support/shared/api_resource_examples.rb +8 -8
  190. data/spec/support/shared/collaborating_accounts_context.rb +2 -2
  191. data/spec/support/shared/config_section_types.rb +2 -2
  192. data/spec/support/tmp_config.rb +4 -8
  193. data/spec/support/token_helpers.rb +1 -1
  194. data/spec/support/vcr.rb +1 -1
  195. data/spec/unit/brightbox/account/get_spec.rb +1 -1
  196. data/spec/unit/brightbox/account_spec.rb +3 -3
  197. data/spec/unit/brightbox/api/find_spec.rb +6 -6
  198. data/spec/unit/brightbox/api/require_account_spec.rb +1 -1
  199. data/spec/unit/brightbox/bb_config/account_spec.rb +3 -3
  200. data/spec/unit/brightbox/bb_config/clear_default_client_spec.rb +8 -8
  201. data/spec/unit/brightbox/bb_config/client_has_alias_spec.rb +3 -3
  202. data/spec/unit/brightbox/bb_config/client_name_spec.rb +5 -5
  203. data/spec/unit/brightbox/bb_config/client_named_spec.rb +6 -6
  204. data/spec/unit/brightbox/bb_config/config_directory_exists_spec.rb +3 -3
  205. data/spec/unit/brightbox/bb_config/config_spec.rb +5 -5
  206. data/spec/unit/brightbox/bb_config/default_account_spec.rb +6 -6
  207. data/spec/unit/brightbox/bb_config/default_client_spec.rb +2 -2
  208. data/spec/unit/brightbox/bb_config/find_or_set_default_account_spec.rb +14 -14
  209. data/spec/unit/brightbox/bb_config/has_multiple_clients_spec.rb +2 -2
  210. data/spec/unit/brightbox/bb_config/renew_tokens_spec.rb +4 -5
  211. data/spec/unit/brightbox/bb_config/save_spec.rb +2 -2
  212. data/spec/unit/brightbox/bb_config/to_fog_spec.rb +2 -2
  213. data/spec/unit/brightbox/bb_config/using_client_spec.rb +10 -10
  214. data/spec/unit/brightbox/collaborating_account/resource_type_spec.rb +4 -4
  215. data/spec/unit/brightbox/collaborating_account_spec.rb +3 -3
  216. data/spec/unit/brightbox/config/api_client/to_fog_spec.rb +2 -2
  217. data/spec/unit/brightbox/config/api_client/valid_spec.rb +5 -5
  218. data/spec/unit/brightbox/config/section_name_deduplicator_spec.rb +1 -1
  219. data/spec/unit/brightbox/config/to_fog_spec.rb +3 -3
  220. data/spec/unit/brightbox/config/user_application/to_fog_spec.rb +2 -2
  221. data/spec/unit/brightbox/config/user_application/valid_spec.rb +6 -6
  222. data/spec/unit/brightbox/connection_manager/fetch_connection_spec.rb +17 -17
  223. data/spec/unit/brightbox/firewall_policy/apply_to_spec.rb +3 -3
  224. data/spec/unit/brightbox/firewall_policy/create_spec.rb +5 -5
  225. data/spec/unit/brightbox/firewall_policy/destroy_spec.rb +4 -4
  226. data/spec/unit/brightbox/firewall_policy/find_or_call_spec.rb +1 -1
  227. data/spec/unit/brightbox/firewall_policy/find_spec.rb +1 -1
  228. data/spec/unit/brightbox/firewall_rule/create_spec.rb +1 -1
  229. data/spec/unit/brightbox/firewall_rule/destroy_spec.rb +2 -2
  230. data/spec/unit/brightbox/firewall_rule/find_spec.rb +3 -3
  231. data/spec/unit/brightbox/firewall_rule/from_policy_spec.rb +2 -2
  232. data/spec/unit/brightbox/legacy/args_adjuster_spec.rb +12 -12
  233. data/spec/unit/brightbox/server/create_spec.rb +2 -2
  234. data/spec/unit/brightbox/server/destroy_spec.rb +3 -3
  235. data/spec/unit/brightbox/server/find_or_call_spec.rb +1 -1
  236. data/spec/unit/brightbox/server/shutdown_spec.rb +2 -4
  237. data/spec/unit/brightbox/server/start_spec.rb +4 -4
  238. data/spec/unit/brightbox/server/stop_spec.rb +2 -4
  239. data/spec/unit/brightbox/server/update_spec.rb +2 -2
  240. data/spec/unit/brightbox/server_group/find_spec.rb +1 -1
  241. data/spec/unit/brightbox/user_collaboration/get_for_account_spec.rb +4 -4
  242. data/spec/unit/brightbox/user_collaboration/remove_spec.rb +11 -11
  243. data/spec/unit/nilable_hash_spec.rb +6 -6
  244. data/spec/unit/tmp_config_spec.rb +1 -1
  245. metadata +67 -31
@@ -6,7 +6,7 @@ require 'shellwords'
6
6
 
7
7
  class String
8
8
  def shellunescape
9
- self.gsub(/\\([^A-Za-z0-9_\-.,:\/@\n])/, '\1')
9
+ gsub(/\\([^A-Za-z0-9_\-.,:\/@\n])/, '\1')
10
10
  end
11
11
  end
12
12
 
@@ -67,7 +67,7 @@ class IcmpTypeName
67
67
  end
68
68
 
69
69
  def find_network_services
70
- File.read("/etc/services").scan(/([0-9]+)\/(tcp|udp)/).collect { |tuple| tuple.first }.uniq
70
+ File.read("/etc/services").scan(/([0-9]+)\/(tcp|udp)/).map { |tuple| tuple.first }.uniq
71
71
  rescue
72
72
  []
73
73
  end
@@ -78,18 +78,18 @@ end
78
78
 
79
79
  def find_identifiers(prefix, extras = nil, flag = nil)
80
80
  if prefix.is_a? Array
81
- lambda do |c,p|
82
- all = prefix.collect { |pfx| find_identifiers(pfx, extras, flag).call(c,p) }
81
+ lambda do |c, p|
82
+ all = prefix.map { |pfx| find_identifiers(pfx, extras, flag).call(c, p) }
83
83
  all += extras if extras.is_a? Array
84
84
  return all.flatten
85
85
  end
86
86
  else
87
- lambda do |cur,prev|
88
- if (extras == :once or flag == :once) and prev =~ /^#{prefix}/
87
+ lambda do |_cur, prev|
88
+ if (extras == :once || flag == :once) && prev =~ /^#{prefix}/
89
89
  return []
90
90
  else
91
- all = Dir.glob(File.join(ENV['HOME'], '.brightbox', 'cache', prefix+'*'))
92
- all.collect! { |f| File.basename(f) }
91
+ all = Dir.glob(File.join(ENV['HOME'], '.brightbox', 'cache', prefix + '*'))
92
+ all.map! { |f| File.basename(f) }
93
93
  all += extras if extras.is_a? Array
94
94
  return all
95
95
  end
@@ -98,24 +98,24 @@ def find_identifiers(prefix, extras = nil, flag = nil)
98
98
  end
99
99
 
100
100
  def find_server_types
101
- find_identifiers("typ-", %w{nano mini small medium large xl xxl nano.high-io mini.high-io small.high-io medium.high0io large.high-io xl.high-io xxl.high-io})
101
+ find_identifiers("typ-", %w(nano mini small medium large xl xxl nano.high-io mini.high-io small.high-io medium.high0io large.high-io xl.high-io xxl.high-io))
102
102
  end
103
103
 
104
104
  def find_clients
105
- lambda do |c,p|
105
+ lambda do |_c, _p|
106
106
  config = File.read(File.join(ENV['HOME'], '.brightbox', 'config')) rescue []
107
107
  config.scan(/^\[(.*)\]/).flatten - ["core"]
108
108
  end
109
109
  end
110
110
 
111
111
  def find_zones
112
- [find_identifiers("zon-", %w{gb1-a gb1-b})]
112
+ [find_identifiers("zon-", %w(gb1-a gb1-b))]
113
113
  end
114
114
 
115
115
  def find_filename
116
- lambda do |cur,prev|
116
+ lambda do |cur, _prev|
117
117
  files = Dir.glob(cur + '*')
118
- if files.size == 1 and File.directory?(files.first)
118
+ if files.size == 1 && File.directory?(files.first)
119
119
  files = [File.join(files.first, '')]
120
120
  files += Dir.glob(File.join(files.first, '*'))
121
121
  end
@@ -125,382 +125,381 @@ end
125
125
 
126
126
  SPEC = { "brightbox" =>
127
127
  {
128
- "account-access" =>
129
- {
130
- "list" => find_identifiers("col-"),
131
- "show" => find_identifiers("col-")
132
- },
133
- "accounts" =>
128
+ "account-access" =>
129
+ {
130
+ "list" => find_identifiers("col-"),
131
+ "show" => find_identifiers("col-")
132
+ },
133
+ "accounts" =>
134
134
  {
135
- "accept_invite" => find_identifiers("acc-"),
136
- "default" => find_identifiers("acc-"),
137
- "list" => true,
138
- "remove" => find_identifiers("acc-"),
139
- "reset_ftp_password" => find_identifiers("acc-"),
140
- "show" => find_identifiers("acc-")
135
+ "accept_invite" => find_identifiers("acc-"),
136
+ "default" => find_identifiers("acc-"),
137
+ "list" => true,
138
+ "remove" => find_identifiers("acc-"),
139
+ "reset_ftp_password" => find_identifiers("acc-"),
140
+ "show" => find_identifiers("acc-")
141
141
  },
142
- "cloudips" =>
142
+ "cloudips" =>
143
143
  {
144
- "create" =>
145
- {
146
- "-i=" => "--count=",
147
- "--count=" => true,
148
- "-n=" => "--name=",
149
- "--name=" => true,
150
- "-t=" => "--port-translators=",
151
- "--port-translators" => true
152
- },
153
- "update" =>
144
+ "create" =>
145
+ {
146
+ "-i=" => "--count=",
147
+ "--count=" => true,
148
+ "-n=" => "--name=",
149
+ "--name=" => true,
150
+ "-t=" => "--port-translators=",
151
+ "--port-translators" => true
152
+ },
153
+ "update" =>
154
154
  {
155
- "-n" => "--name=",
156
- "--name=" => true,
157
- "-r=" => "--reverse-dns=",
158
- "--reverse-dns=" => true,
159
- "-t=" => "--port-translators=",
160
- "--port-translators=" => true,
161
- :include => find_identifiers("cip-")
155
+ "-n" => "--name=",
156
+ "--name=" => true,
157
+ "-r=" => "--reverse-dns=",
158
+ "--reverse-dns=" => true,
159
+ "-t=" => "--port-translators=",
160
+ "--port-translators=" => true,
161
+ :include => find_identifiers("cip-")
162
162
  },
163
- "destroy" => find_identifiers("cip-"),
164
- "list" => find_identifiers("cip-"),
165
- "map" => [find_identifiers('cip-'), find_identifiers("srv-"), nil],
166
- "show" => find_identifiers("cip-"),
167
- "unmap" => find_identifiers("cip-"),
163
+ "destroy" => find_identifiers("cip-"),
164
+ "list" => find_identifiers("cip-"),
165
+ "map" => [find_identifiers('cip-'), find_identifiers("srv-"), nil],
166
+ "show" => find_identifiers("cip-"),
167
+ "unmap" => find_identifiers("cip-")
168
168
  },
169
- "collaborators" =>
169
+ "collaborators" =>
170
170
  {
171
- "invite" => true,
172
- "list" => find_identifiers("col-"),
173
- "destroy" => find_identifiers("col-"),
174
- "resend" => find_identifiers("col-"),
175
- "show" => find_identifiers("col-"),
171
+ "invite" => true,
172
+ "list" => find_identifiers("col-"),
173
+ "destroy" => find_identifiers("col-"),
174
+ "resend" => find_identifiers("col-"),
175
+ "show" => find_identifiers("col-")
176
176
  },
177
- "config" =>
177
+ "config" =>
178
178
  {
179
- "client_add" =>
180
- {
181
- "-a=" => "--alias=",
182
- "--alias=" => true,
183
- "-t=" => "--auth-url=",
184
- "--auth-url=" => true,
185
- },
186
- "client_default" => [find_clients, nil],
187
- "client_list" => true,
188
- "client_remove" => [find_clients, nil],
189
- "user_add" =>
179
+ "client_add" =>
180
+ {
181
+ "-a=" => "--alias=",
182
+ "--alias=" => true,
183
+ "-t=" => "--auth-url=",
184
+ "--auth-url=" => true
185
+ },
186
+ "client_default" => [find_clients, nil],
187
+ "client_list" => true,
188
+ "client_remove" => [find_clients, nil],
189
+ "user_add" =>
190
190
  {
191
- "-a=" => "--alias=",
192
- "--alias=" => true,
193
- "-p=" => "--password=",
194
- "--password=" => true
191
+ "-a=" => "--alias=",
192
+ "--alias=" => true,
193
+ "-p=" => "--password=",
194
+ "--password=" => true
195
195
  }
196
196
  },
197
- "firewall-policies" =>
197
+ "firewall-policies" =>
198
198
  {
199
- "list" => find_identifiers("fwp-"),
200
- "apply" => [find_identifiers("fwp-"), find_identifiers("grp-"), nil],
201
- "create" =>
199
+ "list" => find_identifiers("fwp-"),
200
+ "apply" => [find_identifiers("fwp-"), find_identifiers("grp-"), nil],
201
+ "create" =>
202
202
  {
203
- "-d=" => "--description=",
204
- "--description=" => true,
205
- "-n=" => "--name=",
206
- "--name=" => true,
207
- :include => find_identifiers("grp-")
203
+ "-d=" => "--description=",
204
+ "--description=" => true,
205
+ "-n=" => "--name=",
206
+ "--name=" => true,
207
+ :include => find_identifiers("grp-")
208
208
  },
209
- "update" =>
209
+ "update" =>
210
210
  {
211
- "-d=" => "--description=",
212
- "--description=" => true,
213
- "-n=" => "--name=",
214
- "--name=" => true,
215
- :include => find_identifiers("fwp-")
211
+ "-d=" => "--description=",
212
+ "--description=" => true,
213
+ "-n=" => "--name=",
214
+ "--name=" => true,
215
+ :include => find_identifiers("fwp-")
216
216
  },
217
- "destroy" => find_identifiers("fwp-"),
218
- "remove" => [find_identifiers("fwp-"),find_identifiers("grp-"), nil],
219
- "show" => find_identifiers("fwp-"),
217
+ "destroy" => find_identifiers("fwp-"),
218
+ "remove" => [find_identifiers("fwp-"), find_identifiers("grp-"), nil],
219
+ "show" => find_identifiers("fwp-")
220
220
  },
221
- "firewall-rules" =>
221
+ "firewall-rules" =>
222
222
  {
223
- "create" =>
224
- {
225
- "-d=" => "--destination",
226
- "--destination=" => [find_identifiers(%w{grp- srv-}, %w{any})],
227
- "-s=" => "--source",
228
- "--source=" => [find_identifiers(%w{grp- srv-}, %w{any})],
229
- "-e=" => "--dport=",
230
- "--dport=" => [find_network_services],
231
- "-t=" => "--sport=",
232
- "--sport=" => true,
233
- "-i=" => "--icmptype=",
234
- "--icmptype=" => [find_icmp_types],
235
- "-p=" => "--protocol=",
236
- "--protocol=" => [%w{tcp udp icmp}]
237
- }
223
+ "create" =>
224
+ {
225
+ "-d=" => "--destination",
226
+ "--destination=" => [find_identifiers(%w(grp- srv-), %w(any))],
227
+ "-s=" => "--source",
228
+ "--source=" => [find_identifiers(%w(grp- srv-), %w(any))],
229
+ "-e=" => "--dport=",
230
+ "--dport=" => [find_network_services],
231
+ "-t=" => "--sport=",
232
+ "--sport=" => true,
233
+ "-i=" => "--icmptype=",
234
+ "--icmptype=" => [find_icmp_types],
235
+ "-p=" => "--protocol=",
236
+ "--protocol=" => [%w(tcp udp icmp)]
237
+ }
238
238
  },
239
- "groups" =>
239
+ "groups" =>
240
240
  {
241
- "add_servers" => find_identifiers(%w{grp- srv-}),
242
- "create" =>
241
+ "add_servers" => find_identifiers(%w(grp- srv-)),
242
+ "create" =>
243
243
  {
244
- "-d=" => "--description=",
245
- "--description=" => true,
246
- "-n=" => "--name=",
247
- "--name=" => true
244
+ "-d=" => "--description=",
245
+ "--description=" => true,
246
+ "-n=" => "--name=",
247
+ "--name=" => true
248
248
  },
249
- "update" =>
249
+ "update" =>
250
250
  {
251
- "-d=" => "--description=",
252
- "--description=" => true,
253
- "-n=" => "--name=",
254
- "--name=" => true,
255
- :include => find_identifiers("grp-")
251
+ "-d=" => "--description=",
252
+ "--description=" => true,
253
+ "-n=" => "--name=",
254
+ "--name=" => true,
255
+ :include => find_identifiers("grp-")
256
256
  },
257
- "destroy" => find_identifiers("grp-"),
258
- "list" => find_identifiers("grp-"),
259
- "move_servers" =>
257
+ "destroy" => find_identifiers("grp-"),
258
+ "list" => find_identifiers("grp-"),
259
+ "move_servers" =>
260
260
  {
261
- "-f=" => "--from=",
262
- "--from=" => find_identifiers("grp-"),
263
- "-t=" => "--to=",
264
- "--to=" => find_identifiers("grp-"),
265
- :include => find_identifiers("srv-")
261
+ "-f=" => "--from=",
262
+ "--from=" => find_identifiers("grp-"),
263
+ "-t=" => "--to=",
264
+ "--to=" => find_identifiers("grp-"),
265
+ :include => find_identifiers("srv-")
266
266
  },
267
- "remove_servers" =>
267
+ "remove_servers" =>
268
268
  {
269
- "-a" => "--all",
270
- "--all" => true,
271
- :include => find_identifiers(%w{grp- srv-})
269
+ "-a" => "--all",
270
+ "--all" => true,
271
+ :include => find_identifiers(%w(grp- srv-))
272
272
  },
273
- "show" => find_identifiers("grp-"),
273
+ "show" => find_identifiers("grp-")
274
274
  },
275
- "help" => self,
276
- "images" =>
275
+ "help" => self,
276
+ "images" =>
277
277
  {
278
- "show" => find_identifiers("img-"),
279
- "list" => find_identifiers("img-"),
280
- "destroy" => find_identifiers("img-"),
281
- "register" =>
278
+ "show" => find_identifiers("img-"),
279
+ "list" => find_identifiers("img-"),
280
+ "destroy" => find_identifiers("img-"),
281
+ "register" =>
282
282
  {
283
- "-a=" => "--arch=",
284
- "--arch=" => [%w{i686 x86_64}],
285
- "-d=" => "--description=",
286
- "--description=" => true,
287
- "-m=" => "--mode",
288
- "--mode=" => [%w{virtio compatibility}],
289
- "-n=" => "--name=",
290
- "--name=" => true,
291
- "-p=" => "--public=",
292
- "--public=" => [%w{true false}],
293
- "-s=" => "--source=",
294
- "--source=" => true,
295
- "-u=" => "--username=",
296
- "--username=" => true
283
+ "-a=" => "--arch=",
284
+ "--arch=" => [%w(i686 x86_64)],
285
+ "-d=" => "--description=",
286
+ "--description=" => true,
287
+ "-m=" => "--mode",
288
+ "--mode=" => [%w(virtio compatibility)],
289
+ "-n=" => "--name=",
290
+ "--name=" => true,
291
+ "-p=" => "--public=",
292
+ "--public=" => [%w(true false)],
293
+ "-s=" => "--source=",
294
+ "--source=" => true,
295
+ "-u=" => "--username=",
296
+ "--username=" => true
297
297
  },
298
- "update" =>
298
+ "update" =>
299
299
  {
300
- "-a=" => "--arch=",
301
- "--arch=" => [%w{i686 x86_64}],
302
- "-d=" => "--description=",
303
- "--description=" => true,
304
- "-m=" => "--mode",
305
- "--mode=" => [%w{virtio compatibility}],
306
- "-n=" => "--name=",
307
- "--name=" => true,
308
- "-p=" => "--public=",
309
- "--public=" => [%w{true false}],
310
- "-u=" => "--username=",
311
- "--username=" => true,
312
- "--deprecated=" => [%w{true false}]
313
- },
314
-
300
+ "-a=" => "--arch=",
301
+ "--arch=" => [%w(i686 x86_64)],
302
+ "-d=" => "--description=",
303
+ "--description=" => true,
304
+ "-m=" => "--mode",
305
+ "--mode=" => [%w(virtio compatibility)],
306
+ "-n=" => "--name=",
307
+ "--name=" => true,
308
+ "-p=" => "--public=",
309
+ "--public=" => [%w(true false)],
310
+ "-u=" => "--username=",
311
+ "--username=" => true,
312
+ "--deprecated=" => [%w(true false)]
313
+ }
315
314
  },
316
- "lbs" =>
315
+ "lbs" =>
317
316
  {
318
- "create" =>
319
- {
320
- "-d=" => "--hc-down=",
321
- "--hc-down" => [%w{1 2 3 4 5 7 8 9}],
322
- "-u=" => "--hc-up=",
323
- "--hc-up=" => [%w{1 2 3 4 5 6 7 8 9}],
324
- "-e=" => "--hc-interval=",
325
- "--hc-interval=" => [%w{5000 10000 15000}],
326
- "-k=" => "--hc-port=",
327
- "--hc-port=" => find_network_services,
328
- "-l=" => "--listeners=",
329
- "--listeners=" => true,
330
- "-n=" => "--name=",
331
- "--name=" => true,
332
- "-p=" => "--policy=",
333
- "--policy=" => [%w{least-connections round-robin}],
334
- "-s=" => "--hc-request=",
335
- "--hc-request=" => true,
336
- "-t=" => "--hc-timeout=",
337
- "--hc-timeout=" => [%w{5000 10000 15000}],
338
- "-y=" => "--hc-type=",
339
- "--hc-type=" => [%w{http tcp}],
340
- "--ssl-cert" => true,
341
- "--ssl-key" => true
342
- },
343
- "update" =>
317
+ "create" =>
318
+ {
319
+ "-d=" => "--hc-down=",
320
+ "--hc-down" => [%w(1 2 3 4 5 7 8 9)],
321
+ "-u=" => "--hc-up=",
322
+ "--hc-up=" => [%w(1 2 3 4 5 6 7 8 9)],
323
+ "-e=" => "--hc-interval=",
324
+ "--hc-interval=" => [%w(5000 10000 15000)],
325
+ "-k=" => "--hc-port=",
326
+ "--hc-port=" => find_network_services,
327
+ "-l=" => "--listeners=",
328
+ "--listeners=" => true,
329
+ "-n=" => "--name=",
330
+ "--name=" => true,
331
+ "-p=" => "--policy=",
332
+ "--policy=" => [%w(least-connections round-robin)],
333
+ "-s=" => "--hc-request=",
334
+ "--hc-request=" => true,
335
+ "-t=" => "--hc-timeout=",
336
+ "--hc-timeout=" => [%w(5000 10000 15000)],
337
+ "-y=" => "--hc-type=",
338
+ "--hc-type=" => [%w(http tcp)],
339
+ "--ssl-cert" => true,
340
+ "--ssl-key" => true
341
+ },
342
+ "update" =>
344
343
  {
345
- "-d=" => "--hc-down=",
346
- "--hc-down" => [%w{1 2 3 4 5 7 8 9}],
347
- "-u=" => "--hc-up=",
348
- "--hc-up=" => [%w{1 2 3 4 5 6 7 8 9}],
349
- "-e=" => "--hc-interval=",
350
- "--hc-interval=" => [%w{5000 10000 15000}],
351
- "-k=" => "--hc-port=",
352
- "--hc-port=" => find_network_services,
353
- "-l=" => "--listeners=",
354
- "--listeners=" => true,
355
- "-n=" => "--name=",
356
- "--name=" => true,
357
- "-p=" => "--policy=",
358
- "--policy=" => [%w{least-connections round-robin}],
359
- "-s=" => "--hc-request=",
360
- "--hc-request=" => true,
361
- "-t=" => "--hc-timeout=",
362
- "--hc-timeout=" => [%w{5000 10000 15000}],
363
- "-y=" => "--hc-type=",
364
- "--hc-type=" => [%w{http tcp}],
365
- "--ssl-cert" => true,
366
- "--ssl-key" => true,
367
- "--remove-ssl" => true,
368
- :include => find_identifiers("lba-")
344
+ "-d=" => "--hc-down=",
345
+ "--hc-down" => [%w(1 2 3 4 5 7 8 9)],
346
+ "-u=" => "--hc-up=",
347
+ "--hc-up=" => [%w(1 2 3 4 5 6 7 8 9)],
348
+ "-e=" => "--hc-interval=",
349
+ "--hc-interval=" => [%w(5000 10000 15000)],
350
+ "-k=" => "--hc-port=",
351
+ "--hc-port=" => find_network_services,
352
+ "-l=" => "--listeners=",
353
+ "--listeners=" => true,
354
+ "-n=" => "--name=",
355
+ "--name=" => true,
356
+ "-p=" => "--policy=",
357
+ "--policy=" => [%w(least-connections round-robin)],
358
+ "-s=" => "--hc-request=",
359
+ "--hc-request=" => true,
360
+ "-t=" => "--hc-timeout=",
361
+ "--hc-timeout=" => [%w(5000 10000 15000)],
362
+ "-y=" => "--hc-type=",
363
+ "--hc-type=" => [%w(http tcp)],
364
+ "--ssl-cert" => true,
365
+ "--ssl-key" => true,
366
+ "--remove-ssl" => true,
367
+ :include => find_identifiers("lba-")
369
368
  },
370
- "list" => find_identifiers("lba-"),
371
- "show" => find_identifiers("lba-"),
372
- "destroy" => find_identifiers("lba-"),
373
- "add_nodes" => find_identifiers(%w{lba- srv-}),
374
- "remove_nodes" => find_identifiers(%w{lba- srv-}),
369
+ "list" => find_identifiers("lba-"),
370
+ "show" => find_identifiers("lba-"),
371
+ "destroy" => find_identifiers("lba-"),
372
+ "add_nodes" => find_identifiers(%w(lba- srv-)),
373
+ "remove_nodes" => find_identifiers(%w(lba- srv-)),
375
374
  },
376
- "servers" =>
375
+ "servers" =>
377
376
  {
378
- "create" => {
379
- "-e" => "--no-base64",
380
- "--no-base64" => true,
381
- "--base-64" => true,
382
- "-f=" => "--user-data-file=",
383
- "--user-data-file=" => [find_filename],
384
- "-g=" => "--server-groups=",
385
- "--server-groups=" => [find_identifiers("grp-")],
386
- "-i=" => "--server-count=",
387
- "--server-count=" => true,
388
- "-m=" => "--user-data=",
389
- "--user-data=" => true,
390
- "-n=" => "--name=",
391
- "--name=" => true,
392
- "-t=" => "--type=",
393
- "--type=" => [find_server_types],
394
- "-z=" => "--zone=",
395
- "--zone=" => find_zones,
396
- :include => [find_identifiers("img-")]
397
- },
398
- "update" =>
399
- {
400
- "--no-compatability-mode" => true,
401
- "--compatability-mode" => true,
377
+ "create" => {
402
378
  "-e" => "--no-base64",
403
379
  "--no-base64" => true,
380
+ "--base-64" => true,
404
381
  "-f=" => "--user-data-file=",
405
382
  "--user-data-file=" => [find_filename],
406
- "-g=" => "--server-groups",
383
+ "-g=" => "--server-groups=",
407
384
  "--server-groups=" => [find_identifiers("grp-")],
408
- "-m=" => "--user-data",
385
+ "-i=" => "--server-count=",
386
+ "--server-count=" => true,
387
+ "-m=" => "--user-data=",
409
388
  "--user-data=" => true,
410
389
  "-n=" => "--name=",
411
390
  "--name=" => true,
412
- :include => find_identifiers("srv-"),
413
- },
414
- "activate_console" => find_identifiers("srv-"),
415
- "destroy" => find_identifiers("srv-"),
416
- "list" => find_identifiers("srv-"),
417
- "show" => find_identifiers("srv-"),
418
- "shutdown" => find_identifiers("srv-"),
419
- "snapshot" => find_identifiers("srv-"),
420
- "start" => find_identifiers("srv-"),
421
- "stop" => find_identifiers("srv-")
422
- },
423
- "sql" => {
424
- "instances" => {
425
- "create" => {
426
- "-n=" => "--name=",
427
- "--name" => true,
428
- "-d=" => "--description",
429
- "--description" => true,
430
- "-t" => "--type",
431
- "--type" => true,
432
- "--allow-access" => true,
433
- "--snapshot" => find_identifiers("dbi-")
434
- },
435
- "destroy" => find_identifiers("dbs-"),
436
- "list" => find_identifiers("dbs-"),
437
- "reset_password" => find_identifiers("dbs-"),
438
- "show" => find_identifiers("dbs-"),
439
- "snapshot" => find_identifiers("dbs-"),
440
- "update" => {
441
- "-n=" => "--name=",
442
- "--name" => true,
443
- "-d=" => "--description",
444
- "--description" => true,
445
- "--allow-access" => true,
446
- :include => find_identifiers("dbs-")
447
- },
448
- },
449
- "snapshots" => {
450
- "destroy" => find_identifiers("dbi-"),
451
- "list" => find_identifiers("dbi-"),
452
- "update" => {
453
- "-n=" => "--name=",
454
- "--name" => true,
455
- "-d=" => "--description",
456
- "--description" => true,
457
- :include => find_identifiers("dbi-")
458
- },
459
- },
460
- "types" => {
461
- "list" => find_identifiers("dbt-"),
462
- "show" => find_identifiers("dbt-")
391
+ "-t=" => "--type=",
392
+ "--type=" => [find_server_types],
393
+ "-z=" => "--zone=",
394
+ "--zone=" => find_zones,
395
+ :include => [find_identifiers("img-")]
463
396
  },
397
+ "update" =>
398
+ {
399
+ "--no-compatability-mode" => true,
400
+ "--compatability-mode" => true,
401
+ "-e" => "--no-base64",
402
+ "--no-base64" => true,
403
+ "-f=" => "--user-data-file=",
404
+ "--user-data-file=" => [find_filename],
405
+ "-g=" => "--server-groups",
406
+ "--server-groups=" => [find_identifiers("grp-")],
407
+ "-m=" => "--user-data",
408
+ "--user-data=" => true,
409
+ "-n=" => "--name=",
410
+ "--name=" => true,
411
+ :include => find_identifiers("srv-")
412
+ },
413
+ "activate_console" => find_identifiers("srv-"),
414
+ "destroy" => find_identifiers("srv-"),
415
+ "list" => find_identifiers("srv-"),
416
+ "show" => find_identifiers("srv-"),
417
+ "shutdown" => find_identifiers("srv-"),
418
+ "snapshot" => find_identifiers("srv-"),
419
+ "start" => find_identifiers("srv-"),
420
+ "stop" => find_identifiers("srv-")
464
421
  },
465
- "types" =>
422
+ "sql" => {
423
+ "instances" => {
424
+ "create" => {
425
+ "-n=" => "--name=",
426
+ "--name" => true,
427
+ "-d=" => "--description",
428
+ "--description" => true,
429
+ "-t" => "--type",
430
+ "--type" => true,
431
+ "--allow-access" => true,
432
+ "--snapshot" => find_identifiers("dbi-")
433
+ },
434
+ "destroy" => find_identifiers("dbs-"),
435
+ "list" => find_identifiers("dbs-"),
436
+ "reset_password" => find_identifiers("dbs-"),
437
+ "show" => find_identifiers("dbs-"),
438
+ "snapshot" => find_identifiers("dbs-"),
439
+ "update" => {
440
+ "-n=" => "--name=",
441
+ "--name" => true,
442
+ "-d=" => "--description",
443
+ "--description" => true,
444
+ "--allow-access" => true,
445
+ :include => find_identifiers("dbs-")
446
+ },
447
+ },
448
+ "snapshots" => {
449
+ "destroy" => find_identifiers("dbi-"),
450
+ "list" => find_identifiers("dbi-"),
451
+ "update" => {
452
+ "-n=" => "--name=",
453
+ "--name" => true,
454
+ "-d=" => "--description",
455
+ "--description" => true,
456
+ :include => find_identifiers("dbi-")
457
+ },
458
+ },
459
+ "types" => {
460
+ "list" => find_identifiers("dbt-"),
461
+ "show" => find_identifiers("dbt-")
462
+ },
463
+ },
464
+ "types" =>
466
465
  {
467
- "list" => find_server_types,
468
- "show" => find_server_types
466
+ "list" => find_server_types,
467
+ "show" => find_server_types
469
468
  },
470
- "users" =>
469
+ "users" =>
471
470
  {
472
- "list" => find_identifiers("usr-"),
473
- "show" => find_identifiers("usr-"),
474
- "update" =>
471
+ "list" => find_identifiers("usr-"),
472
+ "show" => find_identifiers("usr-"),
473
+ "update" =>
475
474
  {
476
- "-f=" => "--ssh-key=",
477
- "--ssh-key=" => find_filename,
478
- "-n=" => "--name=",
479
- "--name=" => true,
480
- :include => find_identifiers("usr-")
475
+ "-f=" => "--ssh-key=",
476
+ "--ssh-key=" => find_filename,
477
+ "-n=" => "--name=",
478
+ "--name=" => true,
479
+ :include => find_identifiers("usr-")
481
480
  }
482
481
  },
483
- "zones" =>
482
+ "zones" =>
484
483
  {
485
- "list" => find_zones
484
+ "list" => find_zones
486
485
  },
487
- "-a" => "--account=",
488
- "--account=" => [find_identifiers("acc-")],
489
- "-c=" => "--client=",
490
- "--client=" => [find_clients],
491
- "-k" => "--insecure",
492
- "--insecure" => true
486
+ "-a" => "--account=",
487
+ "--account=" => [find_identifiers("acc-")],
488
+ "-c=" => "--client=",
489
+ "--client=" => [find_clients],
490
+ "-k" => "--insecure",
491
+ "--insecure" => true
493
492
  }
494
493
  }
495
494
 
496
495
  def complete!(a, cur = nil)
497
496
  a = a.keys if a.is_a? Hash
498
- matches = a.find_all { |e| e.index(cur) == 0 }
497
+ matches = a.select { |e| e.index(cur) == 0 }
499
498
  # exclude all option args unless specifically looking for them
500
499
  if cur.index('-') != 0
501
- matches = matches.find_all { |e| e.index('-') != 0 }
500
+ matches = matches.select { |e| e.index('-') != 0 }
502
501
  end
503
- matches.collect! { |m| m.chomp("=") }
502
+ matches.map! { |m| m.chomp("=") }
504
503
  puts matches.join("\n")
505
504
  exit 0
506
505
  end
@@ -510,14 +509,14 @@ def subwalk(a, toks, cur, prev)
510
509
  next if toks.shift
511
510
  case s
512
511
  when Proc
513
- return s.call(cur,prev)
512
+ return s.call(cur, prev)
514
513
  when Array
515
514
  return s
516
515
  when nil
517
516
  return []
518
517
  end
519
518
  end
520
- return nil
519
+ nil
521
520
  end
522
521
 
523
522
  def walk(toks, cur, prev, spec)
@@ -530,12 +529,12 @@ def walk(toks, cur, prev, spec)
530
529
  when :_default
531
530
  # end of the line
532
531
  # exclude any aliases
533
- spec.reject! { |k,v| v.is_a? String }
532
+ spec.reject! { |_k, v| v.is_a? String }
534
533
  options = {}
535
534
  if spec.include? :include
536
535
  r = subwalk(Array(spec[:include]), toks, cur, prev)
537
536
  unless r.nil?
538
- r.each do |k,v|
537
+ r.each do |k, v|
539
538
  options[k] = v
540
539
  end
541
540
  end
@@ -570,7 +569,7 @@ cmd = ARGV[0]
570
569
  cur = ARGV[1].shellunescape
571
570
  prev = ARGV[2].shellunescape
572
571
  point = ENV['COMP_POINT'].to_i
573
- line = ENV['COMP_LINE'][0..point-1].shellunescape
572
+ line = ENV['COMP_LINE'][0..point - 1].shellunescape
574
573
  begin
575
574
  toks = line.shellsplit
576
575
  rescue ArgumentError