hammer_cli 0.19.1 → 2.2.0

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/installation_rpm.md +2 -2
  9. data/doc/release_notes.md +31 -6
  10. data/lib/hammer_cli.rb +1 -0
  11. data/lib/hammer_cli/abstract.rb +61 -4
  12. data/lib/hammer_cli/apipie/api_connection.rb +5 -1
  13. data/lib/hammer_cli/apipie/command.rb +3 -2
  14. data/lib/hammer_cli/apipie/option_builder.rb +15 -13
  15. data/lib/hammer_cli/apipie/option_definition.rb +9 -7
  16. data/lib/hammer_cli/bash.rb +2 -0
  17. data/lib/hammer_cli/bash/completion.rb +159 -0
  18. data/lib/hammer_cli/bash/prebuild_command.rb +21 -0
  19. data/lib/hammer_cli/command_extensions.rb +21 -1
  20. data/lib/hammer_cli/connection.rb +4 -0
  21. data/lib/hammer_cli/exception_handler.rb +11 -2
  22. data/lib/hammer_cli/full_help.rb +8 -1
  23. data/lib/hammer_cli/help/builder.rb +29 -3
  24. data/lib/hammer_cli/logger_watch.rb +1 -1
  25. data/lib/hammer_cli/main.rb +5 -3
  26. data/lib/hammer_cli/options/normalizers.rb +7 -3
  27. data/lib/hammer_cli/options/option_definition.rb +26 -6
  28. data/lib/hammer_cli/options/option_family.rb +114 -0
  29. data/lib/hammer_cli/options/predefined.rb +1 -1
  30. data/lib/hammer_cli/output/adapter/abstract.rb +1 -5
  31. data/lib/hammer_cli/output/adapter/base.rb +1 -1
  32. data/lib/hammer_cli/output/adapter/csv.rb +3 -2
  33. data/lib/hammer_cli/output/adapter/json.rb +14 -3
  34. data/lib/hammer_cli/output/adapter/silent.rb +1 -1
  35. data/lib/hammer_cli/output/adapter/table.rb +27 -8
  36. data/lib/hammer_cli/output/adapter/yaml.rb +6 -3
  37. data/lib/hammer_cli/output/output.rb +2 -4
  38. data/lib/hammer_cli/settings.rb +2 -1
  39. data/lib/hammer_cli/subcommand.rb +25 -1
  40. data/lib/hammer_cli/testing/command_assertions.rb +2 -2
  41. data/lib/hammer_cli/utils.rb +22 -0
  42. data/lib/hammer_cli/version.rb +1 -1
  43. data/locale/ca/LC_MESSAGES/hammer-cli.mo +0 -0
  44. data/locale/de/LC_MESSAGES/hammer-cli.mo +0 -0
  45. data/locale/en/LC_MESSAGES/hammer-cli.mo +0 -0
  46. data/locale/en_GB/LC_MESSAGES/hammer-cli.mo +0 -0
  47. data/locale/es/LC_MESSAGES/hammer-cli.mo +0 -0
  48. data/locale/fr/LC_MESSAGES/hammer-cli.mo +0 -0
  49. data/locale/it/LC_MESSAGES/hammer-cli.mo +0 -0
  50. data/locale/ja/LC_MESSAGES/hammer-cli.mo +0 -0
  51. data/locale/ko/LC_MESSAGES/hammer-cli.mo +0 -0
  52. data/locale/pt_BR/LC_MESSAGES/hammer-cli.mo +0 -0
  53. data/locale/ru/LC_MESSAGES/hammer-cli.mo +0 -0
  54. data/locale/zh_CN/LC_MESSAGES/hammer-cli.mo +0 -0
  55. data/locale/zh_TW/LC_MESSAGES/hammer-cli.mo +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 +17 -6
  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.2.0
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-08-11 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
  - - ">="
@@ -145,10 +145,11 @@ dependencies:
145
145
  version: 0.2.0
146
146
  description: 'Hammer cli provides universal extendable CLI interface for ruby apps
147
147
 
148
- '
148
+ '
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
@@ -174,13 +175,16 @@ extra_rdoc_files:
174
175
  - doc/design.uml
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,7 +394,7 @@ 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.0.8
389
398
  signing_key:
390
399
  specification_version: 4
391
400
  summary: Universal command-line interface
@@ -407,6 +416,7 @@ test_files:
407
416
  - test/unit/command_extensions_test.rb
408
417
  - test/unit/main_test.rb
409
418
  - test/unit/options/processor_list_test.rb
419
+ - test/unit/options/option_family_test.rb
410
420
  - test/unit/options/validators/dsl_test.rb
411
421
  - test/unit/options/sources/command_line_test.rb
412
422
  - test/unit/options/sources/saved_defaults_test.rb
@@ -441,6 +451,7 @@ test_files:
441
451
  - test/unit/fixtures/json_input/invalid.json
442
452
  - test/unit/fixtures/certs/ca_cert.pem
443
453
  - test/unit/fixtures/certs/non_ca_cert.pem
454
+ - test/unit/bash_test.rb
444
455
  - test/unit/help/definition/section_test.rb
445
456
  - test/unit/help/definition/list_test.rb
446
457
  - test/unit/help/definition/text_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
-