hammer_cli 0.0.12 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hammer_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Bačovský
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-12-05 00:00:00.000000000 Z
12
+ date: 2013-12-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: clamp
@@ -130,86 +130,87 @@ executables:
130
130
  - hammer
131
131
  extensions: []
132
132
  extra_rdoc_files:
133
- - README.md
134
- - config/cli_config.template.yml
135
133
  - doc/creating_apipie_commands.md
136
- - doc/creating_commands.md
137
- - doc/design.png
138
- - doc/design.uml
139
- - doc/developer_docs.md
140
134
  - doc/development_tips.md
141
- - doc/writing_a_plugin.md
142
- files:
143
- - LICENSE
144
- - README.md
145
- - bin/hammer
146
- - config/cli_config.template.yml
147
- - doc/creating_apipie_commands.md
135
+ - doc/developer_docs.md
148
136
  - doc/creating_commands.md
149
137
  - doc/design.png
150
138
  - doc/design.uml
151
- - doc/developer_docs.md
152
- - doc/development_tips.md
153
139
  - doc/writing_a_plugin.md
154
- - hammer_cli_complete
155
- - lib/hammer_cli.rb
156
- - lib/hammer_cli/abstract.rb
157
- - lib/hammer_cli/apipie.rb
158
- - lib/hammer_cli/apipie/command.rb
159
- - lib/hammer_cli/apipie/options.rb
160
- - lib/hammer_cli/apipie/read_command.rb
161
- - lib/hammer_cli/apipie/resource.rb
140
+ - config/cli_config.template.yml
141
+ - README.md
142
+ files:
143
+ - lib/hammer_cli/logger_watch.rb
162
144
  - lib/hammer_cli/apipie/write_command.rb
163
- - lib/hammer_cli/autocompletion.rb
164
- - lib/hammer_cli/exception_handler.rb
165
- - lib/hammer_cli/exit_codes.rb
145
+ - lib/hammer_cli/apipie/resource.rb
146
+ - lib/hammer_cli/apipie/read_command.rb
147
+ - lib/hammer_cli/apipie/options.rb
148
+ - lib/hammer_cli/apipie/command.rb
166
149
  - lib/hammer_cli/logger.rb
167
- - lib/hammer_cli/logger_watch.rb
168
- - lib/hammer_cli/main.rb
169
150
  - lib/hammer_cli/messages.rb
170
- - lib/hammer_cli/options/normalizers.rb
171
- - lib/hammer_cli/options/option_definition.rb
151
+ - lib/hammer_cli/abstract.rb
152
+ - lib/hammer_cli/apipie.rb
153
+ - lib/hammer_cli/version.rb
154
+ - lib/hammer_cli/exception_handler.rb
172
155
  - lib/hammer_cli/output.rb
173
- - lib/hammer_cli/output/adapter.rb
174
- - lib/hammer_cli/output/adapter/abstract.rb
156
+ - lib/hammer_cli/shell.rb
157
+ - lib/hammer_cli/utils.rb
158
+ - lib/hammer_cli/output/adapter/table.rb
175
159
  - lib/hammer_cli/output/adapter/base.rb
176
- - lib/hammer_cli/output/adapter/csv.rb
160
+ - lib/hammer_cli/output/adapter/abstract.rb
177
161
  - lib/hammer_cli/output/adapter/silent.rb
178
- - lib/hammer_cli/output/adapter/table.rb
162
+ - lib/hammer_cli/output/adapter/csv.rb
179
163
  - lib/hammer_cli/output/definition.rb
164
+ - lib/hammer_cli/output/adapter.rb
180
165
  - lib/hammer_cli/output/dsl.rb
181
- - lib/hammer_cli/output/fields.rb
182
166
  - lib/hammer_cli/output/formatters.rb
183
167
  - lib/hammer_cli/output/output.rb
168
+ - lib/hammer_cli/output/fields.rb
184
169
  - lib/hammer_cli/output/record_collection.rb
170
+ - lib/hammer_cli/options/option_definition.rb
171
+ - lib/hammer_cli/options/normalizers.rb
172
+ - lib/hammer_cli/completer.rb
185
173
  - lib/hammer_cli/settings.rb
186
- - lib/hammer_cli/shell.rb
187
- - lib/hammer_cli/utils.rb
188
174
  - lib/hammer_cli/validator.rb
189
- - lib/hammer_cli/version.rb
190
- - test/unit/abstract_test.rb
175
+ - lib/hammer_cli/exit_codes.rb
176
+ - lib/hammer_cli/main.rb
177
+ - lib/hammer_cli.rb
191
178
  - test/unit/apipie/command_test.rb
179
+ - test/unit/apipie/write_command_test.rb
192
180
  - test/unit/apipie/fake_api.rb
193
181
  - test/unit/apipie/read_command_test.rb
194
- - test/unit/apipie/write_command_test.rb
182
+ - test/unit/validator_test.rb
183
+ - test/unit/completer_test.rb
184
+ - test/unit/utils_test.rb
195
185
  - test/unit/exception_handler_test.rb
196
186
  - test/unit/main_test.rb
197
- - test/unit/options/normalizers_test.rb
198
- - test/unit/options/option_definition_test.rb
199
- - test/unit/output/adapter/abstract_test.rb
187
+ - test/unit/test_helper.rb
188
+ - test/unit/abstract_test.rb
200
189
  - test/unit/output/adapter/base_test.rb
201
190
  - test/unit/output/adapter/csv_test.rb
191
+ - test/unit/output/adapter/abstract_test.rb
202
192
  - test/unit/output/adapter/table_test.rb
203
- - test/unit/output/definition_test.rb
204
- - test/unit/output/dsl_test.rb
205
- - test/unit/output/fields_test.rb
206
193
  - test/unit/output/formatters_test.rb
194
+ - test/unit/output/dsl_test.rb
195
+ - test/unit/output/definition_test.rb
207
196
  - test/unit/output/output_test.rb
197
+ - test/unit/output/fields_test.rb
208
198
  - test/unit/output/record_collection_test.rb
199
+ - test/unit/options/option_definition_test.rb
200
+ - test/unit/options/normalizers_test.rb
209
201
  - test/unit/settings_test.rb
210
- - test/unit/test_helper.rb
211
- - test/unit/utils_test.rb
212
- - test/unit/validator_test.rb
202
+ - bin/hammer
203
+ - doc/creating_apipie_commands.md
204
+ - doc/development_tips.md
205
+ - doc/developer_docs.md
206
+ - doc/creating_commands.md
207
+ - doc/design.png
208
+ - doc/design.uml
209
+ - doc/writing_a_plugin.md
210
+ - config/cli_config.template.yml
211
+ - LICENSE
212
+ - README.md
213
+ - hammer_cli_complete
213
214
  homepage: http://github.com/theforeman/hammer-cli
214
215
  licenses:
215
216
  - GPL-3
@@ -230,32 +231,33 @@ required_rubygems_version: !ruby/object:Gem::Requirement
230
231
  version: '0'
231
232
  requirements: []
232
233
  rubyforge_project:
233
- rubygems_version: 2.0.13
234
+ rubygems_version: 2.0.14
234
235
  signing_key:
235
236
  specification_version: 4
236
237
  summary: Universal command-line interface
237
238
  test_files:
238
- - test/unit/abstract_test.rb
239
239
  - test/unit/apipie/command_test.rb
240
+ - test/unit/apipie/write_command_test.rb
240
241
  - test/unit/apipie/fake_api.rb
241
242
  - test/unit/apipie/read_command_test.rb
242
- - test/unit/apipie/write_command_test.rb
243
+ - test/unit/validator_test.rb
244
+ - test/unit/completer_test.rb
245
+ - test/unit/utils_test.rb
243
246
  - test/unit/exception_handler_test.rb
244
247
  - test/unit/main_test.rb
245
- - test/unit/options/normalizers_test.rb
246
- - test/unit/options/option_definition_test.rb
247
- - test/unit/output/adapter/abstract_test.rb
248
+ - test/unit/test_helper.rb
249
+ - test/unit/abstract_test.rb
248
250
  - test/unit/output/adapter/base_test.rb
249
251
  - test/unit/output/adapter/csv_test.rb
252
+ - test/unit/output/adapter/abstract_test.rb
250
253
  - test/unit/output/adapter/table_test.rb
251
- - test/unit/output/definition_test.rb
252
- - test/unit/output/dsl_test.rb
253
- - test/unit/output/fields_test.rb
254
254
  - test/unit/output/formatters_test.rb
255
+ - test/unit/output/dsl_test.rb
256
+ - test/unit/output/definition_test.rb
255
257
  - test/unit/output/output_test.rb
258
+ - test/unit/output/fields_test.rb
256
259
  - test/unit/output/record_collection_test.rb
260
+ - test/unit/options/option_definition_test.rb
261
+ - test/unit/options/normalizers_test.rb
257
262
  - test/unit/settings_test.rb
258
- - test/unit/test_helper.rb
259
- - test/unit/utils_test.rb
260
- - test/unit/validator_test.rb
261
263
  has_rdoc:
@@ -1,46 +0,0 @@
1
- module HammerCLI
2
- module Autocompletion
3
-
4
- def autocomplete(line, prefix=[])
5
- endings = []
6
- formated_prefix = prefix.join(' ')
7
-
8
- if line.length == 0 # look for possible next words
9
- all_options = collect_all_options
10
- endings = all_options.keys.map { |e| [e, formated_prefix] }
11
- elsif line.length == 1 && !(find_subcommand(line[0]) || find_option(line[0])) # look for endings
12
- all_options = collect_all_options
13
- endings = all_options.select { |k,v| k if k.start_with? line[0] }.keys.map { |e| [e, formated_prefix] }
14
- else # dive into subcommands
15
- subcommand = find_subcommand line[0]
16
- if subcommand
17
- command = line.shift
18
- prefix << command
19
- endings = subcommand.subcommand_class.autocomplete(line, prefix)
20
- end
21
- end
22
- endings
23
- end
24
-
25
- def collect_all_options
26
- all_options = {}
27
-
28
- if has_subcommands?
29
- recognised_subcommands.each do |item|
30
-
31
- label, _ = item.help
32
- all_options[label] = item
33
- end
34
- end
35
-
36
- recognised_options.each do |item|
37
- label, _ = item.help
38
- label.split(',').each do |option|
39
- all_options[option.split[0]] = item
40
- end
41
- end
42
-
43
- all_options
44
- end
45
- end
46
- end