hammer_cli 0.19.1 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/bin/hammer-complete +28 -0
  3. data/config/cli_config.template.yml +2 -0
  4. data/config/hammer.completion +5 -0
  5. data/doc/commands_extension.md +12 -0
  6. data/doc/creating_commands.md +100 -0
  7. data/doc/installation.md +47 -4
  8. data/doc/release_notes.md +32 -6
  9. data/lib/hammer_cli.rb +1 -0
  10. data/lib/hammer_cli/abstract.rb +61 -4
  11. data/lib/hammer_cli/apipie/api_connection.rb +5 -1
  12. data/lib/hammer_cli/apipie/command.rb +3 -2
  13. data/lib/hammer_cli/apipie/option_builder.rb +15 -13
  14. data/lib/hammer_cli/apipie/option_definition.rb +9 -7
  15. data/lib/hammer_cli/bash.rb +2 -0
  16. data/lib/hammer_cli/bash/completion.rb +159 -0
  17. data/lib/hammer_cli/bash/prebuild_command.rb +21 -0
  18. data/lib/hammer_cli/command_extensions.rb +21 -1
  19. data/lib/hammer_cli/connection.rb +4 -0
  20. data/lib/hammer_cli/exception_handler.rb +11 -2
  21. data/lib/hammer_cli/full_help.rb +8 -1
  22. data/lib/hammer_cli/help/builder.rb +10 -3
  23. data/lib/hammer_cli/logger_watch.rb +1 -1
  24. data/lib/hammer_cli/main.rb +5 -3
  25. data/lib/hammer_cli/options/normalizers.rb +7 -3
  26. data/lib/hammer_cli/options/option_definition.rb +26 -6
  27. data/lib/hammer_cli/options/option_family.rb +114 -0
  28. data/lib/hammer_cli/options/predefined.rb +1 -1
  29. data/lib/hammer_cli/output/adapter/abstract.rb +1 -5
  30. data/lib/hammer_cli/output/adapter/base.rb +1 -1
  31. data/lib/hammer_cli/output/adapter/csv.rb +3 -2
  32. data/lib/hammer_cli/output/adapter/json.rb +14 -3
  33. data/lib/hammer_cli/output/adapter/silent.rb +1 -1
  34. data/lib/hammer_cli/output/adapter/table.rb +27 -8
  35. data/lib/hammer_cli/output/adapter/yaml.rb +6 -3
  36. data/lib/hammer_cli/output/output.rb +2 -4
  37. data/lib/hammer_cli/settings.rb +2 -1
  38. data/lib/hammer_cli/subcommand.rb +25 -1
  39. data/lib/hammer_cli/testing/command_assertions.rb +2 -2
  40. data/lib/hammer_cli/utils.rb +22 -0
  41. data/lib/hammer_cli/version.rb +1 -1
  42. data/locale/ca/LC_MESSAGES/hammer-cli.mo +0 -0
  43. data/locale/de/LC_MESSAGES/hammer-cli.mo +0 -0
  44. data/locale/en/LC_MESSAGES/hammer-cli.mo +0 -0
  45. data/locale/en_GB/LC_MESSAGES/hammer-cli.mo +0 -0
  46. data/locale/es/LC_MESSAGES/hammer-cli.mo +0 -0
  47. data/locale/fr/LC_MESSAGES/hammer-cli.mo +0 -0
  48. data/locale/it/LC_MESSAGES/hammer-cli.mo +0 -0
  49. data/locale/ja/LC_MESSAGES/hammer-cli.mo +0 -0
  50. data/locale/ko/LC_MESSAGES/hammer-cli.mo +0 -0
  51. data/locale/pt_BR/LC_MESSAGES/hammer-cli.mo +0 -0
  52. data/locale/ru/LC_MESSAGES/hammer-cli.mo +0 -0
  53. data/locale/zh_CN/LC_MESSAGES/hammer-cli.mo +0 -0
  54. data/locale/zh_TW/LC_MESSAGES/hammer-cli.mo +0 -0
  55. data/man/hammer.1.gz +0 -0
  56. data/test/unit/abstract_test.rb +23 -2
  57. data/test/unit/apipie/api_connection_test.rb +1 -0
  58. data/test/unit/apipie/option_builder_test.rb +8 -0
  59. data/test/unit/bash_test.rb +138 -0
  60. data/test/unit/command_extensions_test.rb +67 -49
  61. data/test/unit/exception_handler_test.rb +44 -0
  62. data/test/unit/help/builder_test.rb +22 -0
  63. data/test/unit/options/option_family_test.rb +48 -0
  64. data/test/unit/output/adapter/base_test.rb +58 -0
  65. data/test/unit/output/adapter/csv_test.rb +63 -1
  66. data/test/unit/output/adapter/json_test.rb +61 -0
  67. data/test/unit/output/adapter/table_test.rb +70 -1
  68. data/test/unit/output/adapter/yaml_test.rb +59 -0
  69. data/test/unit/output/output_test.rb +3 -3
  70. metadata +82 -71
  71. data/hammer_cli_complete +0 -13
@@ -58,19 +58,19 @@ describe HammerCLI::Output::Output do
58
58
  end
59
59
 
60
60
  it "prints single resource as collection" do
61
- adapter.any_instance.expects(:print_collection).with([], instance_of(HammerCLI::Output::RecordCollection))
61
+ adapter.any_instance.expects(:print_collection).with([], instance_of(HammerCLI::Output::RecordCollection), {})
62
62
  out.print_collection(definition, item1)
63
63
  end
64
64
 
65
65
 
66
66
  it "prints array of resources" do
67
- adapter.any_instance.expects(:print_collection).with([], instance_of(HammerCLI::Output::RecordCollection))
67
+ adapter.any_instance.expects(:print_collection).with([], instance_of(HammerCLI::Output::RecordCollection), {})
68
68
  out.print_collection(definition, collection)
69
69
  end
70
70
 
71
71
  it "prints recordset" do
72
72
  data = HammerCLI::Output::RecordCollection.new(collection)
73
- adapter.any_instance.expects(:print_collection).with([], data)
73
+ adapter.any_instance.expects(:print_collection).with([], data, {})
74
74
  out.print_collection(definition, data)
75
75
  end
76
76
 
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.19.1
4
+ version: 2.1.2
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: 2019-12-31 00:00:00.000000000 Z
12
+ date: 2020-09-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: clamp
@@ -74,7 +74,7 @@ dependencies:
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  - !ruby/object:Gem::Dependency
77
- name: awesome_print
77
+ name: amazing_print
78
78
  requirement: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ">="
@@ -149,38 +149,42 @@ description: 'Hammer cli provides universal extendable CLI interface for ruby ap
149
149
  email: mbacovsk@redhat.com
150
150
  executables:
151
151
  - hammer
152
+ - hammer-complete
152
153
  extensions: []
153
154
  extra_rdoc_files:
154
155
  - doc/commands_extension.md
155
- - doc/release_notes.md
156
- - doc/design.png
157
156
  - doc/commands_modification.md
158
- - doc/installation.md
159
- - doc/development_tips.md
160
- - doc/writing_a_plugin.md
161
- - doc/output.md
157
+ - doc/creating_apipie_commands.md
158
+ - doc/creating_commands.md
159
+ - doc/design.png
160
+ - doc/design.uml
162
161
  - doc/developer_docs.md
162
+ - doc/development_tips.md
163
+ - doc/help_modification.md
164
+ - doc/i18n.md
165
+ - doc/installation.md
163
166
  - doc/installation_deb.md
164
- - doc/option_normalizers.md
165
- - doc/installation_rpm.md
166
167
  - doc/installation_gem.md
167
- - doc/help_modification.md
168
- - doc/creating_commands.md
169
- - doc/installation_source.md
170
168
  - doc/option_builders.md
171
- - doc/i18n.md
169
+ - doc/option_normalizers.md
170
+ - doc/output.md
172
171
  - doc/review_checklist.md
173
- - doc/creating_apipie_commands.md
174
- - doc/design.uml
172
+ - doc/writing_a_plugin.md
173
+ - doc/installation_rpm.md
174
+ - doc/installation_source.md
175
+ - doc/release_notes.md
175
176
  - config/cli.modules.d/module_config_template.yml
176
177
  - config/cli_config.template.yml
178
+ - config/hammer.completion
177
179
  - README.md
178
180
  files:
179
181
  - LICENSE
180
182
  - README.md
181
183
  - bin/hammer
184
+ - bin/hammer-complete
182
185
  - config/cli.modules.d/module_config_template.yml
183
186
  - config/cli_config.template.yml
187
+ - config/hammer.completion
184
188
  - doc/commands_extension.md
185
189
  - doc/commands_modification.md
186
190
  - doc/creating_apipie_commands.md
@@ -202,7 +206,6 @@ files:
202
206
  - doc/release_notes.md
203
207
  - doc/review_checklist.md
204
208
  - doc/writing_a_plugin.md
205
- - hammer_cli_complete
206
209
  - lib/hammer_cli.rb
207
210
  - lib/hammer_cli/abstract.rb
208
211
  - lib/hammer_cli/apipie.rb
@@ -212,6 +215,9 @@ files:
212
215
  - lib/hammer_cli/apipie/option_definition.rb
213
216
  - lib/hammer_cli/apipie/options.rb
214
217
  - lib/hammer_cli/apipie/resource.rb
218
+ - lib/hammer_cli/bash.rb
219
+ - lib/hammer_cli/bash/completion.rb
220
+ - lib/hammer_cli/bash/prebuild_command.rb
215
221
  - lib/hammer_cli/ca_cert_fetcher.rb
216
222
  - lib/hammer_cli/ca_cert_manager.rb
217
223
  - lib/hammer_cli/clamp.rb
@@ -246,6 +252,7 @@ files:
246
252
  - lib/hammer_cli/options/normalizers.rb
247
253
  - lib/hammer_cli/options/option_collector.rb
248
254
  - lib/hammer_cli/options/option_definition.rb
255
+ - lib/hammer_cli/options/option_family.rb
249
256
  - lib/hammer_cli/options/option_processor.rb
250
257
  - lib/hammer_cli/options/predefined.rb
251
258
  - lib/hammer_cli/options/processor_list.rb
@@ -312,6 +319,7 @@ files:
312
319
  - test/unit/apipie/option_builder_test.rb
313
320
  - test/unit/apipie/option_definition_test.rb
314
321
  - test/unit/apipie/test_helper.rb
322
+ - test/unit/bash_test.rb
315
323
  - test/unit/ca_cert_manager_test.rb
316
324
  - test/unit/command_extensions_test.rb
317
325
  - test/unit/completer_test.rb
@@ -346,6 +354,7 @@ files:
346
354
  - test/unit/options/normalizers_test.rb
347
355
  - test/unit/options/option_collector_test.rb
348
356
  - test/unit/options/option_definition_test.rb
357
+ - test/unit/options/option_family_test.rb
349
358
  - test/unit/options/processor_list_test.rb
350
359
  - test/unit/options/sources/command_line_test.rb
351
360
  - test/unit/options/sources/saved_defaults_test.rb
@@ -385,73 +394,75 @@ required_rubygems_version: !ruby/object:Gem::Requirement
385
394
  - !ruby/object:Gem::Version
386
395
  version: '0'
387
396
  requirements: []
388
- rubygems_version: 3.0.3
397
+ rubygems_version: 3.1.2
389
398
  signing_key:
390
399
  specification_version: 4
391
400
  summary: Universal command-line interface
392
401
  test_files:
393
- - test/unit/messages_test.rb
394
- - test/unit/exception_handler_test.rb
395
- - test/unit/modules_test.rb
396
- - test/unit/connection_test.rb
397
- - test/unit/completer_test.rb
398
- - test/unit/csv_parser_test.rb
399
- - test/unit/option_builder_test.rb
400
- - test/unit/test_helper.rb
401
- - test/unit/utils_test.rb
402
+ - test/functional/defaults_test.rb
403
+ - test/functional/help_test.rb
404
+ - test/functional/nil_values_test.rb
405
+ - test/functional/test_helper.rb
406
+ - test/test_helper.rb
407
+ - test/unit/abstract_test.rb
408
+ - test/unit/apipie/api_connection_test.rb
402
409
  - test/unit/apipie/command_test.rb
403
410
  - test/unit/apipie/option_builder_test.rb
404
- - test/unit/apipie/test_helper.rb
405
- - test/unit/apipie/api_connection_test.rb
406
411
  - test/unit/apipie/option_definition_test.rb
412
+ - test/unit/apipie/test_helper.rb
413
+ - test/unit/bash_test.rb
414
+ - test/unit/ca_cert_manager_test.rb
407
415
  - test/unit/command_extensions_test.rb
408
- - test/unit/main_test.rb
409
- - test/unit/options/processor_list_test.rb
410
- - test/unit/options/validators/dsl_test.rb
411
- - test/unit/options/sources/command_line_test.rb
412
- - test/unit/options/sources/saved_defaults_test.rb
413
- - test/unit/options/matcher_test.rb
414
- - test/unit/options/option_collector_test.rb
415
- - test/unit/options/normalizers_test.rb
416
- - test/unit/options/option_definition_test.rb
417
- - test/unit/settings_test.rb
418
- - test/unit/history_test.rb
416
+ - test/unit/completer_test.rb
417
+ - test/unit/connection_test.rb
418
+ - test/unit/csv_parser_test.rb
419
419
  - test/unit/defaults_test.rb
420
- - test/unit/logger_test.rb
421
- - test/unit/output/formatters_test.rb
422
- - test/unit/output/record_collection_test.rb
423
- - test/unit/output/dsl_test.rb
424
- - test/unit/output/definition_test.rb
425
- - test/unit/output/output_test.rb
426
- - test/unit/output/field_filter_test.rb
427
- - test/unit/output/fields_test.rb
428
- - test/unit/output/adapter/table_test.rb
429
- - test/unit/output/adapter/json_test.rb
430
- - test/unit/output/adapter/abstract_test.rb
431
- - test/unit/output/adapter/yaml_test.rb
432
- - test/unit/output/adapter/csv_test.rb
433
- - test/unit/output/adapter/base_test.rb
434
- - test/unit/abstract_test.rb
435
- - test/unit/i18n_test.rb
420
+ - test/unit/exception_handler_test.rb
436
421
  - test/unit/fixtures/apipie/architectures.json
437
422
  - test/unit/fixtures/apipie/documented.json
438
- - test/unit/fixtures/defaults/defaults_dashed.yml
439
- - test/unit/fixtures/defaults/defaults.yml
440
- - test/unit/fixtures/json_input/valid.json
441
- - test/unit/fixtures/json_input/invalid.json
442
423
  - test/unit/fixtures/certs/ca_cert.pem
443
424
  - test/unit/fixtures/certs/non_ca_cert.pem
444
- - test/unit/help/definition/section_test.rb
445
- - test/unit/help/definition/list_test.rb
446
- - test/unit/help/definition/text_test.rb
425
+ - test/unit/fixtures/defaults/defaults.yml
426
+ - test/unit/fixtures/defaults/defaults_dashed.yml
427
+ - test/unit/fixtures/json_input/invalid.json
428
+ - test/unit/fixtures/json_input/valid.json
429
+ - test/unit/help/builder_test.rb
447
430
  - test/unit/help/definition/abstract_item_test.rb
431
+ - test/unit/help/definition/list_test.rb
448
432
  - test/unit/help/definition/note_test.rb
433
+ - test/unit/help/definition/section_test.rb
434
+ - test/unit/help/definition/text_test.rb
449
435
  - test/unit/help/definition_test.rb
450
- - test/unit/help/builder_test.rb
451
436
  - test/unit/help/text_builder_test.rb
452
- - test/unit/ca_cert_manager_test.rb
453
- - test/functional/help_test.rb
454
- - test/functional/test_helper.rb
455
- - test/functional/nil_values_test.rb
456
- - test/functional/defaults_test.rb
457
- - test/test_helper.rb
437
+ - test/unit/history_test.rb
438
+ - test/unit/i18n_test.rb
439
+ - test/unit/logger_test.rb
440
+ - test/unit/main_test.rb
441
+ - test/unit/messages_test.rb
442
+ - test/unit/modules_test.rb
443
+ - test/unit/option_builder_test.rb
444
+ - test/unit/options/matcher_test.rb
445
+ - test/unit/options/normalizers_test.rb
446
+ - test/unit/options/option_collector_test.rb
447
+ - test/unit/options/option_definition_test.rb
448
+ - test/unit/options/option_family_test.rb
449
+ - test/unit/options/processor_list_test.rb
450
+ - test/unit/options/sources/command_line_test.rb
451
+ - test/unit/options/sources/saved_defaults_test.rb
452
+ - test/unit/options/validators/dsl_test.rb
453
+ - test/unit/output/adapter/abstract_test.rb
454
+ - test/unit/output/adapter/base_test.rb
455
+ - test/unit/output/adapter/csv_test.rb
456
+ - test/unit/output/adapter/json_test.rb
457
+ - test/unit/output/adapter/table_test.rb
458
+ - test/unit/output/adapter/yaml_test.rb
459
+ - test/unit/output/definition_test.rb
460
+ - test/unit/output/dsl_test.rb
461
+ - test/unit/output/field_filter_test.rb
462
+ - test/unit/output/fields_test.rb
463
+ - test/unit/output/formatters_test.rb
464
+ - test/unit/output/output_test.rb
465
+ - test/unit/output/record_collection_test.rb
466
+ - test/unit/settings_test.rb
467
+ - test/unit/test_helper.rb
468
+ - test/unit/utils_test.rb
@@ -1,13 +0,0 @@
1
- #
2
- # Hammer CLI bash completion script
3
- #
4
- # vim:ts=2:sw=2:et:
5
- #
6
-
7
- _hammer() {
8
- COMPREPLY=($(hammer --autocomplete "${COMP_WORDS[*]}"))
9
- return 0
10
- }
11
-
12
- complete -F _hammer hammer
13
-