hammer_cli 0.19.0 → 2.1.1

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 (213) 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 -5
  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 +29 -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.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 +30 -80
  36. data/lib/hammer_cli/output/adapter/yaml.rb +6 -3
  37. data/lib/hammer_cli/output/definition.rb +11 -56
  38. data/lib/hammer_cli/output/generators.rb +1 -0
  39. data/lib/hammer_cli/output/generators/table.rb +121 -0
  40. data/lib/hammer_cli/output/output.rb +2 -4
  41. data/lib/hammer_cli/settings.rb +2 -1
  42. data/lib/hammer_cli/subcommand.rb +25 -1
  43. data/lib/hammer_cli/testing/command_assertions.rb +2 -2
  44. data/lib/hammer_cli/utils.rb +22 -0
  45. data/lib/hammer_cli/version.rb +1 -1
  46. data/locale/ca/LC_MESSAGES/hammer-cli.mo +0 -0
  47. data/locale/de/LC_MESSAGES/hammer-cli.mo +0 -0
  48. data/locale/en/LC_MESSAGES/hammer-cli.mo +0 -0
  49. data/locale/en_GB/LC_MESSAGES/hammer-cli.mo +0 -0
  50. data/locale/es/LC_MESSAGES/hammer-cli.mo +0 -0
  51. data/locale/fr/LC_MESSAGES/hammer-cli.mo +0 -0
  52. data/locale/it/LC_MESSAGES/hammer-cli.mo +0 -0
  53. data/locale/ja/LC_MESSAGES/hammer-cli.mo +0 -0
  54. data/locale/ko/LC_MESSAGES/hammer-cli.mo +0 -0
  55. data/locale/pt_BR/LC_MESSAGES/hammer-cli.mo +0 -0
  56. data/locale/ru/LC_MESSAGES/hammer-cli.mo +0 -0
  57. data/locale/zh_CN/LC_MESSAGES/hammer-cli.mo +0 -0
  58. data/locale/zh_TW/LC_MESSAGES/hammer-cli.mo +0 -0
  59. data/man/hammer.1.gz +0 -0
  60. data/test/unit/abstract_test.rb +23 -2
  61. data/test/unit/apipie/api_connection_test.rb +1 -0
  62. data/test/unit/apipie/option_builder_test.rb +8 -0
  63. data/test/unit/bash_test.rb +138 -0
  64. data/test/unit/command_extensions_test.rb +67 -49
  65. data/test/unit/exception_handler_test.rb +44 -0
  66. data/test/unit/help/builder_test.rb +22 -0
  67. data/test/unit/options/option_family_test.rb +48 -0
  68. data/test/unit/output/adapter/base_test.rb +58 -0
  69. data/test/unit/output/adapter/csv_test.rb +63 -1
  70. data/test/unit/output/adapter/json_test.rb +61 -0
  71. data/test/unit/output/adapter/table_test.rb +70 -1
  72. data/test/unit/output/adapter/yaml_test.rb +59 -0
  73. data/test/unit/output/definition_test.rb +7 -7
  74. data/test/unit/output/output_test.rb +3 -3
  75. metadata +83 -345
  76. data/hammer_cli_complete +0 -13
  77. data/test/reports/TEST-Fields-ContainerField-display-.xml +0 -7
  78. data/test/reports/TEST-Fields-ContainerField-display-blank-is-allowed.xml +0 -15
  79. data/test/reports/TEST-Fields-ContainerField-display-blank-is-not-allowed.xml +0 -15
  80. data/test/reports/TEST-Fields-ContainerField.xml +0 -7
  81. data/test/reports/TEST-Fields-Field-display-.xml +0 -7
  82. data/test/reports/TEST-Fields-Field-display-blank-is-allowed.xml +0 -11
  83. data/test/reports/TEST-Fields-Field-display-blank-is-not-allowed.xml +0 -11
  84. data/test/reports/TEST-Fields-Field-hide-blank-.xml +0 -11
  85. data/test/reports/TEST-Fields-Field-parameters.xml +0 -9
  86. data/test/reports/TEST-Fields-Field.xml +0 -13
  87. data/test/reports/TEST-HammerCLI-AbstractCommand-build-options.xml +0 -15
  88. data/test/reports/TEST-HammerCLI-AbstractCommand-exception-handler.xml +0 -13
  89. data/test/reports/TEST-HammerCLI-AbstractCommand-logging.xml +0 -21
  90. data/test/reports/TEST-HammerCLI-AbstractCommand-option-builder.xml +0 -11
  91. data/test/reports/TEST-HammerCLI-AbstractCommand-options.xml +0 -11
  92. data/test/reports/TEST-HammerCLI-AbstractCommand-output.xml +0 -19
  93. data/test/reports/TEST-HammerCLI-AbstractCommand-subcommand-behavior-remove-subcommand.xml +0 -11
  94. data/test/reports/TEST-HammerCLI-AbstractCommand-subcommand-behavior-subcommand-.xml +0 -13
  95. data/test/reports/TEST-HammerCLI-AbstractCommand-subcommand-behavior-subcommand.xml +0 -11
  96. data/test/reports/TEST-HammerCLI-AbstractCommand-subcommand-behavior.xml +0 -7
  97. data/test/reports/TEST-HammerCLI-AbstractCommand.xml +0 -11
  98. data/test/reports/TEST-HammerCLI-Apipie-Command-options.xml +0 -11
  99. data/test/reports/TEST-HammerCLI-Apipie-Command-resource-defined.xml +0 -9
  100. data/test/reports/TEST-HammerCLI-Apipie-Command-setting-resources.xml +0 -19
  101. data/test/reports/TEST-HammerCLI-Apipie-Command.xml +0 -9
  102. data/test/reports/TEST-HammerCLI-Apipie-OptionBuilder-aliasing-resources.xml +0 -13
  103. data/test/reports/TEST-HammerCLI-Apipie-OptionBuilder-filtering-options.xml +0 -15
  104. data/test/reports/TEST-HammerCLI-Apipie-OptionBuilder-required-options.xml +0 -11
  105. data/test/reports/TEST-HammerCLI-Apipie-OptionBuilder-setting-correct-normalizers.xml +0 -9
  106. data/test/reports/TEST-HammerCLI-Apipie-OptionBuilder-with-hash-params.xml +0 -11
  107. data/test/reports/TEST-HammerCLI-Apipie-OptionBuilder-with-one-simple-param.xml +0 -15
  108. data/test/reports/TEST-HammerCLI-Apipie-OptionBuilder.xml +0 -7
  109. data/test/reports/TEST-HammerCLI-Completer-command-completion.xml +0 -29
  110. data/test/reports/TEST-HammerCLI-Completer-option-value-completion.xml +0 -17
  111. data/test/reports/TEST-HammerCLI-Completer-subcommand-completion.xml +0 -19
  112. data/test/reports/TEST-HammerCLI-Completer.xml +0 -7
  113. data/test/reports/TEST-HammerCLI-CompleterLine-line-complete.xml +0 -25
  114. data/test/reports/TEST-HammerCLI-CompleterLine-splitting-words.xml +0 -29
  115. data/test/reports/TEST-HammerCLI-CompleterLine.xml +0 -7
  116. data/test/reports/TEST-HammerCLI-CompleterWord-complete-.xml +0 -23
  117. data/test/reports/TEST-HammerCLI-CompleterWord-quote.xml +0 -15
  118. data/test/reports/TEST-HammerCLI-CompleterWord-quoted-.xml +0 -13
  119. data/test/reports/TEST-HammerCLI-CompleterWord.xml +0 -7
  120. data/test/reports/TEST-HammerCLI-Connection.xml +0 -21
  121. data/test/reports/TEST-HammerCLI-ExceptionHandler.xml +0 -21
  122. data/test/reports/TEST-HammerCLI-I18n.xml +0 -11
  123. data/test/reports/TEST-HammerCLI-MainCommand-loading-context-password.xml +0 -11
  124. data/test/reports/TEST-HammerCLI-MainCommand-loading-context-username.xml +0 -11
  125. data/test/reports/TEST-HammerCLI-MainCommand-loading-context-verbose.xml +0 -9
  126. data/test/reports/TEST-HammerCLI-MainCommand-loading-context.xml +0 -7
  127. data/test/reports/TEST-HammerCLI-MainCommand.xml +0 -7
  128. data/test/reports/TEST-HammerCLI-Modules-find-by-name.xml +0 -13
  129. data/test/reports/TEST-HammerCLI-Modules-load-a-module-module-not-found.xml +0 -13
  130. data/test/reports/TEST-HammerCLI-Modules-load-a-module-module-runtime-exception.xml +0 -13
  131. data/test/reports/TEST-HammerCLI-Modules-load-a-module-success.xml +0 -15
  132. data/test/reports/TEST-HammerCLI-Modules-load-a-module.xml +0 -7
  133. data/test/reports/TEST-HammerCLI-Modules-load-all-modules.xml +0 -9
  134. data/test/reports/TEST-HammerCLI-Modules-names.xml +0 -13
  135. data/test/reports/TEST-HammerCLI-Modules.xml +0 -7
  136. data/test/reports/TEST-HammerCLI-OptionBuilderContainer.0.xml +0 -7
  137. data/test/reports/TEST-HammerCLI-OptionBuilderContainer.xml +0 -11
  138. data/test/reports/TEST-HammerCLI-Options-Normalizers-abstract.xml +0 -9
  139. data/test/reports/TEST-HammerCLI-Options-Normalizers-bool.xml +0 -31
  140. data/test/reports/TEST-HammerCLI-Options-Normalizers-datetime.xml +0 -17
  141. data/test/reports/TEST-HammerCLI-Options-Normalizers-enum.xml +0 -15
  142. data/test/reports/TEST-HammerCLI-Options-Normalizers-enumlist.xml +0 -21
  143. data/test/reports/TEST-HammerCLI-Options-Normalizers-json-input.xml +0 -15
  144. data/test/reports/TEST-HammerCLI-Options-Normalizers-key-value-list.xml +0 -17
  145. data/test/reports/TEST-HammerCLI-Options-Normalizers-list.xml +0 -15
  146. data/test/reports/TEST-HammerCLI-Options-Normalizers.xml +0 -7
  147. data/test/reports/TEST-HammerCLI-Options-OptionDefinition-context.xml +0 -9
  148. data/test/reports/TEST-HammerCLI-Options-OptionDefinition-formatters.xml +0 -11
  149. data/test/reports/TEST-HammerCLI-Options-OptionDefinition.xml +0 -7
  150. data/test/reports/TEST-HammerCLI-Output-Adapter-Abstract-error-messages.xml +0 -15
  151. data/test/reports/TEST-HammerCLI-Output-Adapter-Abstract-messages.xml +0 -11
  152. data/test/reports/TEST-HammerCLI-Output-Adapter-Abstract-test-data-for-field.xml +0 -15
  153. data/test/reports/TEST-HammerCLI-Output-Adapter-Abstract.xml +0 -17
  154. data/test/reports/TEST-HammerCLI-Output-Adapter-Base-print-collection-show-ids.xml +0 -9
  155. data/test/reports/TEST-HammerCLI-Output-Adapter-Base-print-collection.xml +0 -27
  156. data/test/reports/TEST-HammerCLI-Output-Adapter-Base.xml +0 -7
  157. data/test/reports/TEST-HammerCLI-Output-Adapter-CSValues-print-collection-formatters.xml +0 -11
  158. data/test/reports/TEST-HammerCLI-Output-Adapter-CSValues-print-collection-handle-fields-with-collections.xml +0 -13
  159. data/test/reports/TEST-HammerCLI-Output-Adapter-CSValues-print-collection-handle-fields-with-containers.xml +0 -11
  160. data/test/reports/TEST-HammerCLI-Output-Adapter-CSValues-print-collection-handle-ids.xml +0 -11
  161. data/test/reports/TEST-HammerCLI-Output-Adapter-CSValues-print-collection.xml +0 -11
  162. data/test/reports/TEST-HammerCLI-Output-Adapter-CSValues-print-message.xml +0 -11
  163. data/test/reports/TEST-HammerCLI-Output-Adapter-CSValues.xml +0 -7
  164. data/test/reports/TEST-HammerCLI-Output-Adapter-Table-print-collection-column-width.xml +0 -15
  165. data/test/reports/TEST-HammerCLI-Output-Adapter-Table-print-collection-formatters.xml +0 -11
  166. data/test/reports/TEST-HammerCLI-Output-Adapter-Table-print-collection-handle-ids.xml +0 -11
  167. data/test/reports/TEST-HammerCLI-Output-Adapter-Table-print-collection-sort-columns.xml +0 -9
  168. data/test/reports/TEST-HammerCLI-Output-Adapter-Table-print-collection.xml +0 -11
  169. data/test/reports/TEST-HammerCLI-Output-Adapter-Table.xml +0 -7
  170. data/test/reports/TEST-HammerCLI-Output-Definition-empty-.xml +0 -11
  171. data/test/reports/TEST-HammerCLI-Output-Definition.xml +0 -11
  172. data/test/reports/TEST-HammerCLI-Output-Dsl-collection.xml +0 -13
  173. data/test/reports/TEST-HammerCLI-Output-Dsl-custom-fields.xml +0 -11
  174. data/test/reports/TEST-HammerCLI-Output-Dsl-fields.xml +0 -15
  175. data/test/reports/TEST-HammerCLI-Output-Dsl-label.xml +0 -13
  176. data/test/reports/TEST-HammerCLI-Output-Dsl-path-definition.xml +0 -13
  177. data/test/reports/TEST-HammerCLI-Output-Dsl.xml +0 -9
  178. data/test/reports/TEST-HammerCLI-Output-FieldFilter.xml +0 -13
  179. data/test/reports/TEST-HammerCLI-Output-Formatters-BooleanFormatter.xml +0 -11
  180. data/test/reports/TEST-HammerCLI-Output-Formatters-ColorFormatter.xml +0 -9
  181. data/test/reports/TEST-HammerCLI-Output-Formatters-DateFormatter.xml +0 -11
  182. data/test/reports/TEST-HammerCLI-Output-Formatters-FieldFormatter.xml +0 -13
  183. data/test/reports/TEST-HammerCLI-Output-Formatters-FormatterContainer.xml +0 -13
  184. data/test/reports/TEST-HammerCLI-Output-Formatters-FormatterLibrary.xml +0 -11
  185. data/test/reports/TEST-HammerCLI-Output-Formatters-KeyValueFormatter.xml +0 -13
  186. data/test/reports/TEST-HammerCLI-Output-Formatters-ListFormatter.xml +0 -13
  187. data/test/reports/TEST-HammerCLI-Output-Formatters-LongTextFormatter.xml +0 -13
  188. data/test/reports/TEST-HammerCLI-Output-Output-adapters.xml +0 -17
  189. data/test/reports/TEST-HammerCLI-Output-Output-data.xml +0 -15
  190. data/test/reports/TEST-HammerCLI-Output-Output-formatters.xml +0 -9
  191. data/test/reports/TEST-HammerCLI-Output-Output-messages.xml +0 -19
  192. data/test/reports/TEST-HammerCLI-Output-Output.xml +0 -7
  193. data/test/reports/TEST-HammerCLI-Output-RecordCollection.xml +0 -13
  194. data/test/reports/TEST-HammerCLI-Settings-load-from-paths.xml +0 -15
  195. data/test/reports/TEST-HammerCLI-Settings.xml +0 -25
  196. data/test/reports/TEST-HammerCLI-ShellHistory-loading-old-history.xml +0 -11
  197. data/test/reports/TEST-HammerCLI-ShellHistory-saving-history.xml +0 -15
  198. data/test/reports/TEST-HammerCLI-ShellHistory.xml +0 -7
  199. data/test/reports/TEST-MiniTest-Spec.xml +0 -7
  200. data/test/reports/TEST-String-camelize.xml +0 -11
  201. data/test/reports/TEST-String-formatting.xml +0 -17
  202. data/test/reports/TEST-String-indent.xml +0 -11
  203. data/test/reports/TEST-String-interactive-.xml +0 -13
  204. data/test/reports/TEST-String.xml +0 -7
  205. data/test/reports/TEST-constraints-HammerCLI-Validator-AllConstraint-exist-.xml +0 -13
  206. data/test/reports/TEST-constraints-HammerCLI-Validator-AllConstraint.xml +0 -7
  207. data/test/reports/TEST-constraints-HammerCLI-Validator-AnyConstraint-exist-.xml +0 -13
  208. data/test/reports/TEST-constraints-HammerCLI-Validator-AnyConstraint.xml +0 -7
  209. data/test/reports/TEST-constraints-HammerCLI-Validator-BaseConstraint-exist-.xml +0 -9
  210. data/test/reports/TEST-constraints-HammerCLI-Validator-BaseConstraint-rejected.xml +0 -13
  211. data/test/reports/TEST-constraints-HammerCLI-Validator-BaseConstraint-required.xml +0 -13
  212. data/test/reports/TEST-constraints-HammerCLI-Validator-BaseConstraint.xml +0 -7
  213. data/test/reports/TEST-constraints.xml +0 -7
@@ -199,6 +199,64 @@ describe HammerCLI::Output::Adapter::Base do
199
199
  proc { adapter.print_collection(fields, data) }.must_output(expected_output)
200
200
  end
201
201
 
202
+ context 'printing by chunks' do
203
+ let(:context) { { show_ids: true } }
204
+ let(:collection_count) { 30 }
205
+ let(:collection_data) do
206
+ collection = collection_count.times.each_with_object([]) do |t, r|
207
+ r << { id: t, name: "John #{t}"}
208
+ end
209
+ HammerCLI::Output::RecordCollection.new(collection)
210
+ end
211
+ let(:fields) { [id, name] }
212
+
213
+ it 'prints single chunk' do
214
+ expected_output = collection_count.times.each_with_object([]) do |t, r|
215
+ r << ["Id: #{t}", "Name: John #{t}", "\n"].join("\n")
216
+ end.flatten(1).join
217
+
218
+ proc do
219
+ adapter.print_collection(fields, collection_data)
220
+ end.must_output(expected_output)
221
+ end
222
+
223
+ it 'prints first chunk' do
224
+ expected_output = 10.times.each_with_object([]) do |t, r|
225
+ r << ["Id: #{t}", "Name: John #{t}", "\n"].join("\n")
226
+ end.flatten(1).join
227
+
228
+ proc do
229
+ adapter.print_collection(
230
+ fields, collection_data[0...10], current_chunk: :first
231
+ )
232
+ end.must_output(expected_output)
233
+ end
234
+
235
+ it 'prints another chunk' do
236
+ expected_output = (10...20).each_with_object([]) do |t, r|
237
+ r << ["Id: #{t}", "Name: John #{t}", "\n"].join("\n")
238
+ end.flatten(1).join
239
+
240
+ proc do
241
+ adapter.print_collection(
242
+ fields, collection_data[10...20], current_chunk: :another
243
+ )
244
+ end.must_output(expected_output)
245
+ end
246
+
247
+ it 'prints last chunk' do
248
+ expected_output = (20...30).each_with_object([]) do |t, r|
249
+ r << ["Id: #{t}", "Name: John #{t}", "\n"].join("\n")
250
+ end.flatten(1).join
251
+
252
+ proc do
253
+ adapter.print_collection(
254
+ fields, collection_data[20...30], current_chunk: :last
255
+ )
256
+ end.must_output(expected_output)
257
+ end
258
+ end
259
+
202
260
  context "show ids" do
203
261
 
204
262
  let(:context) { {:show_ids => true} }
@@ -9,7 +9,7 @@ describe HammerCLI::Output::Adapter::CSValues do
9
9
  end
10
10
 
11
11
  context "print_collection" do
12
-
12
+ let(:field_id) { Fields::Id.new(:path => [:id], :label => "Id") }
13
13
  let(:field_name) { Fields::Field.new(:path => [:name], :label => "Name") }
14
14
  let(:field_started_at) { Fields::Field.new(:path => [:started_at], :label => "Started At") }
15
15
  let(:field_login) { Fields::Field.new(:path => [:login], :label => "Login") }
@@ -220,6 +220,68 @@ describe HammerCLI::Output::Adapter::CSValues do
220
220
  end
221
221
  end
222
222
 
223
+ context 'printing by chunks' do
224
+ let(:adapter) { HammerCLI::Output::Adapter::CSValues.new(show_ids: true) }
225
+ let(:collection_count) { 30 }
226
+ let(:collection_data) do
227
+ collection = collection_count.times.each_with_object([]) do |t, r|
228
+ r << { id: t, name: "John #{t}"}
229
+ end
230
+ HammerCLI::Output::RecordCollection.new(collection)
231
+ end
232
+ let(:fields) { [field_id, field_name] }
233
+
234
+ it 'prints single chunk' do
235
+ expected_output = collection_count.times.each_with_object([]) do |t, r|
236
+ r << ["#{t}", "John #{t}"].join(',')
237
+ end.flatten(1).unshift('Id,Name').join("\n") + "\n"
238
+
239
+ out, _err = capture_io do
240
+ adapter.print_collection(fields, collection_data)
241
+ end
242
+ out.must_equal(expected_output)
243
+ end
244
+
245
+ it 'prints first chunk' do
246
+ expected_output = 10.times.each_with_object([]) do |t, r|
247
+ r << ["#{t}", "John #{t}"].join(',')
248
+ end.flatten(1).unshift('Id,Name').join("\n") + "\n"
249
+
250
+ out, _err = capture_io do
251
+ adapter.print_collection(
252
+ fields, collection_data[0...10], current_chunk: :first
253
+ )
254
+ end
255
+ out.must_equal(expected_output)
256
+ end
257
+
258
+ it 'prints another chunk' do
259
+ expected_output = (10...20).each_with_object([]) do |t, r|
260
+ r << ["#{t}", "John #{t}"].join(',')
261
+ end.flatten(1).join("\n") + "\n"
262
+
263
+ out, _err = capture_io do
264
+ adapter.print_collection(
265
+ fields, collection_data[10...20], current_chunk: :another
266
+ )
267
+ end
268
+ out.must_equal(expected_output)
269
+ end
270
+
271
+ it 'prints last chunk' do
272
+ expected_output = (20...30).each_with_object([]) do |t, r|
273
+ r << ["#{t}", "John #{t}"].join(',')
274
+ end.flatten(1).join("\n") + "\n"
275
+
276
+ out, _err = capture_io do
277
+ adapter.print_collection(
278
+ fields, collection_data[20...30], current_chunk: :last
279
+ )
280
+ end
281
+ out.must_equal(expected_output)
282
+ end
283
+ end
284
+
223
285
  context "output_stream" do
224
286
 
225
287
  let(:tempfile) { Tempfile.new("output_stream_csv_test_temp") }
@@ -316,6 +316,67 @@ describe HammerCLI::Output::Adapter::Json do
316
316
  end
317
317
  end
318
318
 
319
+ context 'printing by chunks' do
320
+ let(:settings) { HammerCLI::Settings }
321
+ let(:context) { { show_ids: true, capitalization: HammerCLI.capitalization } }
322
+ let(:collection_count) { 30 }
323
+ let(:collection) do
324
+ collection_count.times.each_with_object([]) do |t, r|
325
+ r << { id: t, name: "John #{t}"}
326
+ end
327
+ end
328
+ let(:collection_data) do
329
+ HammerCLI::Output::RecordCollection.new(collection)
330
+ end
331
+ let(:fields) { [id, name] }
332
+
333
+ before do
334
+ settings.load(ui: { capitalization: :downcase })
335
+ end
336
+
337
+ it 'prints single chunk' do
338
+ expected_output = JSON.pretty_generate(collection) + "\n"
339
+
340
+ out, _err = capture_io do
341
+ adapter.print_collection(fields, collection_data)
342
+ end
343
+ out.must_equal(expected_output)
344
+ end
345
+
346
+ it 'prints first chunk' do
347
+ expected_output = JSON.pretty_generate(collection[0...10])[0...-2] + ",\n"
348
+
349
+ out, _err = capture_io do
350
+ adapter.print_collection(
351
+ fields, collection_data[0...10], current_chunk: :first
352
+ )
353
+ end
354
+ out.must_equal(expected_output)
355
+ end
356
+
357
+ it 'prints another chunk' do
358
+ expected_output = JSON.pretty_generate(collection[10...20])[2...-2] + ",\n"
359
+
360
+ out, _err = capture_io do
361
+ adapter.print_collection(
362
+ fields, collection_data[10...20], current_chunk: :another
363
+ )
364
+ end
365
+ out.must_equal(expected_output)
366
+ end
367
+
368
+ it 'prints last chunk' do
369
+ expected_output = JSON.pretty_generate(collection[20...30])[2..-1] + "\n"
370
+
371
+ out, _err = capture_io do
372
+ adapter.print_collection(
373
+ fields, collection_data[20...30], current_chunk: :last
374
+ )
375
+ end
376
+ out.must_equal(expected_output)
377
+ end
378
+ end
379
+
319
380
  context "show ids" do
320
381
 
321
382
  let(:context) { {:show_ids => true} }
@@ -9,7 +9,7 @@ describe HammerCLI::Output::Adapter::Table do
9
9
  end
10
10
 
11
11
  context "print_collection" do
12
-
12
+ let(:field_id) { Fields::Id.new(:path => [:id], :label => "Id") }
13
13
  let(:field_name) { Fields::Field.new(:path => [:fullname], :label => "Name") }
14
14
  let(:field_firstname) { Fields::Field.new(:path => [:firstname], :label => "Firstname") }
15
15
  let(:field_lastname) { Fields::Field.new(:path => [:lastname], :label => "Lastname") }
@@ -380,6 +380,75 @@ describe HammerCLI::Output::Adapter::Table do
380
380
 
381
381
  end
382
382
 
383
+ context 'printing by chunks' do
384
+ let(:adapter) { HammerCLI::Output::Adapter::Table.new(show_ids: true) }
385
+ let(:collection_count) { 30 }
386
+ let(:collection_data) do
387
+ collection = collection_count.times.each_with_object([]) do |t, r|
388
+ r << { id: t, fullname: "John Doe #{t}"}
389
+ end
390
+ HammerCLI::Output::RecordCollection.new(collection)
391
+ end
392
+ let(:fields) { [field_id, field_name] }
393
+
394
+ it 'prints single chunk' do
395
+ expected_output = collection_count.times.each_with_object([]) do |t, r|
396
+ sp = t < 10 ? ' ' : ''
397
+ r << ["#{t} #{sp}| John Doe #{t}#{sp}"]
398
+ end.flatten(1).unshift(
399
+ '---|------------',
400
+ 'ID | NAME ',
401
+ "---|------------",
402
+ ).join("\n") + "\n---|------------\n"
403
+
404
+ proc do
405
+ adapter.print_collection(fields, collection_data)
406
+ end.must_output(expected_output)
407
+ end
408
+
409
+ it 'prints first chunk' do
410
+ expected_output = (0...10).each_with_object([]) do |t, r|
411
+ r << [
412
+ "#{t} | John Doe #{t}"
413
+ ]
414
+ end.flatten(1).unshift(
415
+ '---|-----------',
416
+ 'ID | NAME ',
417
+ "---|-----------",
418
+ ).join("\n") + "\n"
419
+
420
+ proc do
421
+ adapter.print_collection(
422
+ fields, collection_data[0...10], current_chunk: :first
423
+ )
424
+ end.must_output(expected_output)
425
+ end
426
+
427
+ it 'prints another chunk' do
428
+ expected_output = (10...20).each_with_object([]) do |t, r|
429
+ r << ["#{t} | John Doe #{t}"]
430
+ end.flatten(1).join("\n") + "\n"
431
+
432
+ proc do
433
+ adapter.print_collection(
434
+ fields, collection_data[10...20], current_chunk: :another
435
+ )
436
+ end.must_output(expected_output)
437
+ end
438
+ #
439
+ it 'prints last chunk' do
440
+ expected_output = (20...30).each_with_object([]) do |t, r|
441
+ r << ["#{t} | John Doe #{t}"]
442
+ end.flatten(1).join("\n") + "\n---|------------\n"
443
+
444
+ proc do
445
+ adapter.print_collection(
446
+ fields, collection_data[20...30], current_chunk: :last
447
+ )
448
+ end.must_output(expected_output)
449
+ end
450
+ end
451
+
383
452
  context "output_stream" do
384
453
 
385
454
  let(:tempfile) { Tempfile.new("output_stream_table_test_temp") }
@@ -312,6 +312,65 @@ describe HammerCLI::Output::Adapter::Yaml do
312
312
  end
313
313
  end
314
314
 
315
+ context 'printing by chunks' do
316
+ let(:context) { { show_ids: true } }
317
+ let(:collection_count) { 30 }
318
+ let(:collection) do
319
+ collection_count.times.each_with_object([]) do |t, r|
320
+ r << { id: t, name: "John #{t}"}
321
+ end
322
+ end
323
+ let(:prepared_collection) do
324
+ collection.map { |i| i.transform_keys { |k| k.to_s.capitalize } }
325
+ end
326
+ let(:collection_data) do
327
+ HammerCLI::Output::RecordCollection.new(collection)
328
+ end
329
+ let(:fields) { [id, name] }
330
+
331
+ it 'prints single chunk' do
332
+ expected_output = YAML.dump(prepared_collection)
333
+
334
+ out, _err = capture_io do
335
+ adapter.print_collection(fields, collection_data)
336
+ end
337
+ out.must_equal(expected_output)
338
+ end
339
+
340
+ it 'prints first chunk' do
341
+ expected_output = YAML.dump(prepared_collection[0...10])
342
+
343
+ out, _err = capture_io do
344
+ adapter.print_collection(
345
+ fields, collection_data[0...10], current_chunk: :first
346
+ )
347
+ end
348
+ out.must_equal(expected_output)
349
+ end
350
+
351
+ it 'prints another chunk' do
352
+ expected_output = YAML.dump(prepared_collection[10...20])[4..-1]
353
+
354
+ out, _err = capture_io do
355
+ adapter.print_collection(
356
+ fields, collection_data[10...20], current_chunk: :another
357
+ )
358
+ end
359
+ out.must_equal(expected_output)
360
+ end
361
+
362
+ it 'prints last chunk' do
363
+ expected_output = YAML.dump(prepared_collection[20...30])[4..-1]
364
+
365
+ out, _err = capture_io do
366
+ adapter.print_collection(
367
+ fields, collection_data[20...30], current_chunk: :last
368
+ )
369
+ end
370
+ out.must_equal(expected_output)
371
+ end
372
+ end
373
+
315
374
  context "show ids" do
316
375
 
317
376
  let(:context) { {:show_ids => true} }
@@ -266,13 +266,13 @@ describe HammerCLI::Output::Definition do
266
266
  end
267
267
  definition.fields += [new_field, cont_field]
268
268
 
269
- sets_table = "+----------+-----+---------+-----+
270
- | Fields | ALL | DEFAULT | SET |
271
- +----------+-----+---------+-----+
272
- | newfield | x | x | |
273
- | cf/abc | | | x |
274
- | cf/bca | | | x |
275
- +----------+-----+---------+-----+\n"
269
+ sets_table = "---------|-----|---------|----\n" \
270
+ "FIELDS | ALL | DEFAULT | SET\n" \
271
+ "---------|-----|---------|----\n" \
272
+ "newfield | x | x | \n" \
273
+ "cf/abc | | | x \n" \
274
+ "cf/bca | | | x \n" \
275
+ "---------|-----|---------|----\n"
276
276
 
277
277
  definition.sets_table.must_equal sets_table
278
278
  end
@@ -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.0
4
+ version: 2.1.1
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-10-26 00:00:00.000000000 Z
12
+ date: 2020-05-29 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
- - doc/design.png
155
- - doc/option_normalizers.md
156
- - doc/release_notes.md
155
+ - doc/commands_extension.md
157
156
  - doc/commands_modification.md
157
+ - doc/creating_apipie_commands.md
158
158
  - doc/creating_commands.md
159
- - doc/commands_extension.md
160
- - doc/development_tips.md
159
+ - doc/design.png
160
+ - doc/design.uml
161
161
  - doc/developer_docs.md
162
- - doc/writing_a_plugin.md
163
- - doc/option_builders.md
164
- - doc/installation_rpm.md
162
+ - doc/development_tips.md
163
+ - doc/help_modification.md
165
164
  - doc/i18n.md
166
165
  - doc/installation.md
167
- - doc/review_checklist.md
168
- - doc/help_modification.md
166
+ - doc/installation_deb.md
167
+ - doc/installation_gem.md
168
+ - doc/installation_rpm.md
169
169
  - doc/installation_source.md
170
+ - doc/option_builders.md
171
+ - doc/option_normalizers.md
170
172
  - doc/output.md
171
- - doc/design.uml
172
- - doc/installation_gem.md
173
- - doc/creating_apipie_commands.md
174
- - doc/installation_deb.md
175
- - config/cli_config.template.yml
173
+ - doc/review_checklist.md
174
+ - doc/writing_a_plugin.md
175
+ - doc/release_notes.md
176
176
  - config/cli.modules.d/module_config_template.yml
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
@@ -271,6 +278,8 @@ files:
271
278
  - lib/hammer_cli/output/field_filter.rb
272
279
  - lib/hammer_cli/output/fields.rb
273
280
  - lib/hammer_cli/output/formatters.rb
281
+ - lib/hammer_cli/output/generators.rb
282
+ - lib/hammer_cli/output/generators/table.rb
274
283
  - lib/hammer_cli/output/output.rb
275
284
  - lib/hammer_cli/output/record_collection.rb
276
285
  - lib/hammer_cli/output/utils.rb
@@ -303,143 +312,6 @@ files:
303
312
  - test/functional/help_test.rb
304
313
  - test/functional/nil_values_test.rb
305
314
  - test/functional/test_helper.rb
306
- - test/reports/TEST-Fields-ContainerField-display-.xml
307
- - test/reports/TEST-Fields-ContainerField-display-blank-is-allowed.xml
308
- - test/reports/TEST-Fields-ContainerField-display-blank-is-not-allowed.xml
309
- - test/reports/TEST-Fields-ContainerField.xml
310
- - test/reports/TEST-Fields-Field-display-.xml
311
- - test/reports/TEST-Fields-Field-display-blank-is-allowed.xml
312
- - test/reports/TEST-Fields-Field-display-blank-is-not-allowed.xml
313
- - test/reports/TEST-Fields-Field-hide-blank-.xml
314
- - test/reports/TEST-Fields-Field-parameters.xml
315
- - test/reports/TEST-Fields-Field.xml
316
- - test/reports/TEST-HammerCLI-AbstractCommand-build-options.xml
317
- - test/reports/TEST-HammerCLI-AbstractCommand-exception-handler.xml
318
- - test/reports/TEST-HammerCLI-AbstractCommand-logging.xml
319
- - test/reports/TEST-HammerCLI-AbstractCommand-option-builder.xml
320
- - test/reports/TEST-HammerCLI-AbstractCommand-options.xml
321
- - test/reports/TEST-HammerCLI-AbstractCommand-output.xml
322
- - test/reports/TEST-HammerCLI-AbstractCommand-subcommand-behavior-remove-subcommand.xml
323
- - test/reports/TEST-HammerCLI-AbstractCommand-subcommand-behavior-subcommand-.xml
324
- - test/reports/TEST-HammerCLI-AbstractCommand-subcommand-behavior-subcommand.xml
325
- - test/reports/TEST-HammerCLI-AbstractCommand-subcommand-behavior.xml
326
- - test/reports/TEST-HammerCLI-AbstractCommand.xml
327
- - test/reports/TEST-HammerCLI-Apipie-Command-options.xml
328
- - test/reports/TEST-HammerCLI-Apipie-Command-resource-defined.xml
329
- - test/reports/TEST-HammerCLI-Apipie-Command-setting-resources.xml
330
- - test/reports/TEST-HammerCLI-Apipie-Command.xml
331
- - test/reports/TEST-HammerCLI-Apipie-OptionBuilder-aliasing-resources.xml
332
- - test/reports/TEST-HammerCLI-Apipie-OptionBuilder-filtering-options.xml
333
- - test/reports/TEST-HammerCLI-Apipie-OptionBuilder-required-options.xml
334
- - test/reports/TEST-HammerCLI-Apipie-OptionBuilder-setting-correct-normalizers.xml
335
- - test/reports/TEST-HammerCLI-Apipie-OptionBuilder-with-hash-params.xml
336
- - test/reports/TEST-HammerCLI-Apipie-OptionBuilder-with-one-simple-param.xml
337
- - test/reports/TEST-HammerCLI-Apipie-OptionBuilder.xml
338
- - test/reports/TEST-HammerCLI-Completer-command-completion.xml
339
- - test/reports/TEST-HammerCLI-Completer-option-value-completion.xml
340
- - test/reports/TEST-HammerCLI-Completer-subcommand-completion.xml
341
- - test/reports/TEST-HammerCLI-Completer.xml
342
- - test/reports/TEST-HammerCLI-CompleterLine-line-complete.xml
343
- - test/reports/TEST-HammerCLI-CompleterLine-splitting-words.xml
344
- - test/reports/TEST-HammerCLI-CompleterLine.xml
345
- - test/reports/TEST-HammerCLI-CompleterWord-complete-.xml
346
- - test/reports/TEST-HammerCLI-CompleterWord-quote.xml
347
- - test/reports/TEST-HammerCLI-CompleterWord-quoted-.xml
348
- - test/reports/TEST-HammerCLI-CompleterWord.xml
349
- - test/reports/TEST-HammerCLI-Connection.xml
350
- - test/reports/TEST-HammerCLI-ExceptionHandler.xml
351
- - test/reports/TEST-HammerCLI-I18n.xml
352
- - test/reports/TEST-HammerCLI-MainCommand-loading-context-password.xml
353
- - test/reports/TEST-HammerCLI-MainCommand-loading-context-username.xml
354
- - test/reports/TEST-HammerCLI-MainCommand-loading-context-verbose.xml
355
- - test/reports/TEST-HammerCLI-MainCommand-loading-context.xml
356
- - test/reports/TEST-HammerCLI-MainCommand.xml
357
- - test/reports/TEST-HammerCLI-Modules-find-by-name.xml
358
- - test/reports/TEST-HammerCLI-Modules-load-a-module-module-not-found.xml
359
- - test/reports/TEST-HammerCLI-Modules-load-a-module-module-runtime-exception.xml
360
- - test/reports/TEST-HammerCLI-Modules-load-a-module-success.xml
361
- - test/reports/TEST-HammerCLI-Modules-load-a-module.xml
362
- - test/reports/TEST-HammerCLI-Modules-load-all-modules.xml
363
- - test/reports/TEST-HammerCLI-Modules-names.xml
364
- - test/reports/TEST-HammerCLI-Modules.xml
365
- - test/reports/TEST-HammerCLI-OptionBuilderContainer.0.xml
366
- - test/reports/TEST-HammerCLI-OptionBuilderContainer.xml
367
- - test/reports/TEST-HammerCLI-Options-Normalizers-abstract.xml
368
- - test/reports/TEST-HammerCLI-Options-Normalizers-bool.xml
369
- - test/reports/TEST-HammerCLI-Options-Normalizers-datetime.xml
370
- - test/reports/TEST-HammerCLI-Options-Normalizers-enum.xml
371
- - test/reports/TEST-HammerCLI-Options-Normalizers-enumlist.xml
372
- - test/reports/TEST-HammerCLI-Options-Normalizers-json-input.xml
373
- - test/reports/TEST-HammerCLI-Options-Normalizers-key-value-list.xml
374
- - test/reports/TEST-HammerCLI-Options-Normalizers-list.xml
375
- - test/reports/TEST-HammerCLI-Options-Normalizers.xml
376
- - test/reports/TEST-HammerCLI-Options-OptionDefinition-context.xml
377
- - test/reports/TEST-HammerCLI-Options-OptionDefinition-formatters.xml
378
- - test/reports/TEST-HammerCLI-Options-OptionDefinition.xml
379
- - test/reports/TEST-HammerCLI-Output-Adapter-Abstract-error-messages.xml
380
- - test/reports/TEST-HammerCLI-Output-Adapter-Abstract-messages.xml
381
- - test/reports/TEST-HammerCLI-Output-Adapter-Abstract-test-data-for-field.xml
382
- - test/reports/TEST-HammerCLI-Output-Adapter-Abstract.xml
383
- - test/reports/TEST-HammerCLI-Output-Adapter-Base-print-collection-show-ids.xml
384
- - test/reports/TEST-HammerCLI-Output-Adapter-Base-print-collection.xml
385
- - test/reports/TEST-HammerCLI-Output-Adapter-Base.xml
386
- - test/reports/TEST-HammerCLI-Output-Adapter-CSValues-print-collection-formatters.xml
387
- - test/reports/TEST-HammerCLI-Output-Adapter-CSValues-print-collection-handle-fields-with-collections.xml
388
- - test/reports/TEST-HammerCLI-Output-Adapter-CSValues-print-collection-handle-fields-with-containers.xml
389
- - test/reports/TEST-HammerCLI-Output-Adapter-CSValues-print-collection-handle-ids.xml
390
- - test/reports/TEST-HammerCLI-Output-Adapter-CSValues-print-collection.xml
391
- - test/reports/TEST-HammerCLI-Output-Adapter-CSValues-print-message.xml
392
- - test/reports/TEST-HammerCLI-Output-Adapter-CSValues.xml
393
- - test/reports/TEST-HammerCLI-Output-Adapter-Table-print-collection-column-width.xml
394
- - test/reports/TEST-HammerCLI-Output-Adapter-Table-print-collection-formatters.xml
395
- - test/reports/TEST-HammerCLI-Output-Adapter-Table-print-collection-handle-ids.xml
396
- - test/reports/TEST-HammerCLI-Output-Adapter-Table-print-collection-sort-columns.xml
397
- - test/reports/TEST-HammerCLI-Output-Adapter-Table-print-collection.xml
398
- - test/reports/TEST-HammerCLI-Output-Adapter-Table.xml
399
- - test/reports/TEST-HammerCLI-Output-Definition-empty-.xml
400
- - test/reports/TEST-HammerCLI-Output-Definition.xml
401
- - test/reports/TEST-HammerCLI-Output-Dsl-collection.xml
402
- - test/reports/TEST-HammerCLI-Output-Dsl-custom-fields.xml
403
- - test/reports/TEST-HammerCLI-Output-Dsl-fields.xml
404
- - test/reports/TEST-HammerCLI-Output-Dsl-label.xml
405
- - test/reports/TEST-HammerCLI-Output-Dsl-path-definition.xml
406
- - test/reports/TEST-HammerCLI-Output-Dsl.xml
407
- - test/reports/TEST-HammerCLI-Output-FieldFilter.xml
408
- - test/reports/TEST-HammerCLI-Output-Formatters-BooleanFormatter.xml
409
- - test/reports/TEST-HammerCLI-Output-Formatters-ColorFormatter.xml
410
- - test/reports/TEST-HammerCLI-Output-Formatters-DateFormatter.xml
411
- - test/reports/TEST-HammerCLI-Output-Formatters-FieldFormatter.xml
412
- - test/reports/TEST-HammerCLI-Output-Formatters-FormatterContainer.xml
413
- - test/reports/TEST-HammerCLI-Output-Formatters-FormatterLibrary.xml
414
- - test/reports/TEST-HammerCLI-Output-Formatters-KeyValueFormatter.xml
415
- - test/reports/TEST-HammerCLI-Output-Formatters-ListFormatter.xml
416
- - test/reports/TEST-HammerCLI-Output-Formatters-LongTextFormatter.xml
417
- - test/reports/TEST-HammerCLI-Output-Output-adapters.xml
418
- - test/reports/TEST-HammerCLI-Output-Output-data.xml
419
- - test/reports/TEST-HammerCLI-Output-Output-formatters.xml
420
- - test/reports/TEST-HammerCLI-Output-Output-messages.xml
421
- - test/reports/TEST-HammerCLI-Output-Output.xml
422
- - test/reports/TEST-HammerCLI-Output-RecordCollection.xml
423
- - test/reports/TEST-HammerCLI-Settings-load-from-paths.xml
424
- - test/reports/TEST-HammerCLI-Settings.xml
425
- - test/reports/TEST-HammerCLI-ShellHistory-loading-old-history.xml
426
- - test/reports/TEST-HammerCLI-ShellHistory-saving-history.xml
427
- - test/reports/TEST-HammerCLI-ShellHistory.xml
428
- - test/reports/TEST-MiniTest-Spec.xml
429
- - test/reports/TEST-String-camelize.xml
430
- - test/reports/TEST-String-formatting.xml
431
- - test/reports/TEST-String-indent.xml
432
- - test/reports/TEST-String-interactive-.xml
433
- - test/reports/TEST-String.xml
434
- - test/reports/TEST-constraints-HammerCLI-Validator-AllConstraint-exist-.xml
435
- - test/reports/TEST-constraints-HammerCLI-Validator-AllConstraint.xml
436
- - test/reports/TEST-constraints-HammerCLI-Validator-AnyConstraint-exist-.xml
437
- - test/reports/TEST-constraints-HammerCLI-Validator-AnyConstraint.xml
438
- - test/reports/TEST-constraints-HammerCLI-Validator-BaseConstraint-exist-.xml
439
- - test/reports/TEST-constraints-HammerCLI-Validator-BaseConstraint-rejected.xml
440
- - test/reports/TEST-constraints-HammerCLI-Validator-BaseConstraint-required.xml
441
- - test/reports/TEST-constraints-HammerCLI-Validator-BaseConstraint.xml
442
- - test/reports/TEST-constraints.xml
443
315
  - test/test_helper.rb
444
316
  - test/unit/abstract_test.rb
445
317
  - test/unit/apipie/api_connection_test.rb
@@ -447,6 +319,7 @@ files:
447
319
  - test/unit/apipie/option_builder_test.rb
448
320
  - test/unit/apipie/option_definition_test.rb
449
321
  - test/unit/apipie/test_helper.rb
322
+ - test/unit/bash_test.rb
450
323
  - test/unit/ca_cert_manager_test.rb
451
324
  - test/unit/command_extensions_test.rb
452
325
  - test/unit/completer_test.rb
@@ -481,6 +354,7 @@ files:
481
354
  - test/unit/options/normalizers_test.rb
482
355
  - test/unit/options/option_collector_test.rb
483
356
  - test/unit/options/option_definition_test.rb
357
+ - test/unit/options/option_family_test.rb
484
358
  - test/unit/options/processor_list_test.rb
485
359
  - test/unit/options/sources/command_line_test.rb
486
360
  - test/unit/options/sources/saved_defaults_test.rb
@@ -520,211 +394,75 @@ required_rubygems_version: !ruby/object:Gem::Requirement
520
394
  - !ruby/object:Gem::Version
521
395
  version: '0'
522
396
  requirements: []
523
- rubyforge_project:
524
- rubygems_version: 2.7.10
397
+ rubygems_version: 3.1.2
525
398
  signing_key:
526
399
  specification_version: 4
527
400
  summary: Universal command-line interface
528
401
  test_files:
529
- - test/reports/TEST-HammerCLI-CompleterWord-quoted-.xml
530
- - test/reports/TEST-String-interactive-.xml
531
- - test/reports/TEST-HammerCLI-Output-Formatters-BooleanFormatter.xml
532
- - test/reports/TEST-HammerCLI-Apipie-OptionBuilder.xml
533
- - test/reports/TEST-HammerCLI-Output-Dsl-path-definition.xml
534
- - test/reports/TEST-HammerCLI-AbstractCommand-output.xml
535
- - test/reports/TEST-HammerCLI-ShellHistory-loading-old-history.xml
536
- - test/reports/TEST-Fields-Field-display-blank-is-allowed.xml
537
- - test/reports/TEST-HammerCLI-Completer.xml
538
- - test/reports/TEST-HammerCLI-Output-Output-adapters.xml
539
- - test/reports/TEST-HammerCLI-MainCommand-loading-context.xml
540
- - test/reports/TEST-HammerCLI-MainCommand-loading-context-username.xml
541
- - test/reports/TEST-HammerCLI-Output-Formatters-ColorFormatter.xml
542
- - test/reports/TEST-HammerCLI-Modules-load-a-module-module-runtime-exception.xml
543
- - test/reports/TEST-HammerCLI-Modules-load-all-modules.xml
544
- - test/reports/TEST-HammerCLI-Output-Definition.xml
545
- - test/reports/TEST-Fields-Field-hide-blank-.xml
546
- - test/reports/TEST-HammerCLI-Apipie-Command-resource-defined.xml
547
- - test/reports/TEST-Fields-ContainerField-display-blank-is-not-allowed.xml
548
- - test/reports/TEST-constraints-HammerCLI-Validator-BaseConstraint-exist-.xml
549
- - test/reports/TEST-HammerCLI-Output-Adapter-Base-print-collection.xml
550
- - test/reports/TEST-HammerCLI-OptionBuilderContainer.0.xml
551
- - test/reports/TEST-HammerCLI-Apipie-OptionBuilder-required-options.xml
552
- - test/reports/TEST-HammerCLI-Output-Adapter-CSValues-print-collection-handle-fields-with-containers.xml
553
- - test/reports/TEST-HammerCLI-AbstractCommand-subcommand-behavior.xml
554
- - test/reports/TEST-MiniTest-Spec.xml
555
- - test/reports/TEST-HammerCLI-Output-Adapter-Base.xml
556
- - test/reports/TEST-HammerCLI-Completer-subcommand-completion.xml
557
- - test/reports/TEST-Fields-Field-display-blank-is-not-allowed.xml
558
- - test/reports/TEST-HammerCLI-Apipie-Command-setting-resources.xml
559
- - test/reports/TEST-HammerCLI-Options-Normalizers-abstract.xml
560
- - test/reports/TEST-HammerCLI-Modules-load-a-module-success.xml
561
- - test/reports/TEST-Fields-Field.xml
562
- - test/reports/TEST-HammerCLI-Output-RecordCollection.xml
563
- - test/reports/TEST-HammerCLI-Options-Normalizers-list.xml
564
- - test/reports/TEST-HammerCLI-Output-Adapter-Table.xml
565
- - test/reports/TEST-HammerCLI-Modules.xml
566
- - test/reports/TEST-HammerCLI-Output-Formatters-FieldFormatter.xml
567
- - test/reports/TEST-HammerCLI-Output-Dsl-label.xml
568
- - test/reports/TEST-HammerCLI-Completer-command-completion.xml
569
- - test/reports/TEST-HammerCLI-Modules-find-by-name.xml
570
- - test/reports/TEST-HammerCLI-Options-OptionDefinition.xml
571
- - test/reports/TEST-Fields-ContainerField-display-.xml
572
- - test/reports/TEST-HammerCLI-Apipie-OptionBuilder-filtering-options.xml
573
- - test/reports/TEST-HammerCLI-Output-Formatters-DateFormatter.xml
574
- - test/reports/TEST-HammerCLI-Output-Adapter-CSValues-print-collection-handle-ids.xml
575
- - test/reports/TEST-HammerCLI-AbstractCommand.xml
576
- - test/reports/TEST-constraints-HammerCLI-Validator-AllConstraint-exist-.xml
577
- - test/reports/TEST-HammerCLI-Settings-load-from-paths.xml
578
- - test/reports/TEST-HammerCLI-AbstractCommand-build-options.xml
579
- - test/reports/TEST-HammerCLI-Options-Normalizers-enumlist.xml
580
- - test/reports/TEST-HammerCLI-Options-OptionDefinition-context.xml
581
- - test/reports/TEST-HammerCLI-Output-Definition-empty-.xml
582
- - test/reports/TEST-HammerCLI-Output-Formatters-KeyValueFormatter.xml
583
- - test/reports/TEST-HammerCLI-Output-FieldFilter.xml
584
- - test/reports/TEST-HammerCLI-MainCommand-loading-context-password.xml
585
- - test/reports/TEST-HammerCLI-Modules-load-a-module.xml
586
- - test/reports/TEST-HammerCLI-Output-Dsl.xml
587
- - test/reports/TEST-Fields-ContainerField-display-blank-is-allowed.xml
588
- - test/reports/TEST-constraints.xml
589
- - test/reports/TEST-String-camelize.xml
590
- - test/reports/TEST-HammerCLI-Settings.xml
591
- - test/reports/TEST-HammerCLI-ExceptionHandler.xml
592
- - test/reports/TEST-constraints-HammerCLI-Validator-BaseConstraint-required.xml
593
- - test/reports/TEST-HammerCLI-Options-Normalizers-bool.xml
594
- - test/reports/TEST-HammerCLI-AbstractCommand-logging.xml
595
- - test/reports/TEST-HammerCLI-Output-Formatters-ListFormatter.xml
596
- - test/reports/TEST-HammerCLI-Output-Formatters-FormatterLibrary.xml
597
- - test/reports/TEST-HammerCLI-Output-Adapter-Table-print-collection-formatters.xml
598
- - test/reports/TEST-Fields-ContainerField.xml
599
- - test/reports/TEST-HammerCLI-Output-Adapter-Abstract-messages.xml
600
- - test/reports/TEST-HammerCLI-Output-Output-data.xml
601
- - test/reports/TEST-HammerCLI-Apipie-OptionBuilder-aliasing-resources.xml
602
- - test/reports/TEST-HammerCLI-Options-Normalizers-key-value-list.xml
603
- - test/reports/TEST-constraints-HammerCLI-Validator-AnyConstraint-exist-.xml
604
- - test/reports/TEST-HammerCLI-AbstractCommand-subcommand-behavior-subcommand.xml
605
- - test/reports/TEST-HammerCLI-Completer-option-value-completion.xml
606
- - test/reports/TEST-HammerCLI-Output-Adapter-Abstract-error-messages.xml
607
- - test/reports/TEST-constraints-HammerCLI-Validator-BaseConstraint.xml
608
- - test/reports/TEST-HammerCLI-Output-Formatters-FormatterContainer.xml
609
- - test/reports/TEST-HammerCLI-MainCommand.xml
610
- - test/reports/TEST-HammerCLI-Output-Adapter-CSValues-print-message.xml
611
- - test/reports/TEST-HammerCLI-CompleterWord-quote.xml
612
- - test/reports/TEST-HammerCLI-Apipie-OptionBuilder-with-one-simple-param.xml
613
- - test/reports/TEST-HammerCLI-Apipie-OptionBuilder-with-hash-params.xml
614
- - test/reports/TEST-HammerCLI-ShellHistory-saving-history.xml
615
- - test/reports/TEST-HammerCLI-AbstractCommand-exception-handler.xml
616
- - test/reports/TEST-String-formatting.xml
617
- - test/reports/TEST-HammerCLI-Output-Adapter-Abstract.xml
618
- - test/reports/TEST-constraints-HammerCLI-Validator-AllConstraint.xml
619
- - test/reports/TEST-HammerCLI-Output-Dsl-collection.xml
620
- - test/reports/TEST-HammerCLI-Output-Dsl-fields.xml
621
- - test/reports/TEST-HammerCLI-Output-Adapter-Table-print-collection.xml
622
- - test/reports/TEST-HammerCLI-Output-Adapter-Table-print-collection-sort-columns.xml
623
- - test/reports/TEST-HammerCLI-OptionBuilderContainer.xml
624
- - test/reports/TEST-HammerCLI-Output-Adapter-CSValues-print-collection.xml
625
- - test/reports/TEST-HammerCLI-Modules-names.xml
626
- - test/reports/TEST-HammerCLI-AbstractCommand-subcommand-behavior-subcommand-.xml
627
- - test/reports/TEST-HammerCLI-Output-Adapter-CSValues-print-collection-handle-fields-with-collections.xml
628
- - test/reports/TEST-HammerCLI-MainCommand-loading-context-verbose.xml
629
- - test/reports/TEST-HammerCLI-Output-Adapter-Table-print-collection-handle-ids.xml
630
- - test/reports/TEST-HammerCLI-Options-Normalizers-datetime.xml
631
- - test/reports/TEST-HammerCLI-Output-Output-messages.xml
632
- - test/reports/TEST-HammerCLI-AbstractCommand-subcommand-behavior-remove-subcommand.xml
633
- - test/reports/TEST-HammerCLI-CompleterLine-line-complete.xml
634
- - test/reports/TEST-constraints-HammerCLI-Validator-BaseConstraint-rejected.xml
635
- - test/reports/TEST-HammerCLI-Apipie-Command.xml
636
- - test/reports/TEST-HammerCLI-AbstractCommand-option-builder.xml
637
- - test/reports/TEST-HammerCLI-Options-Normalizers-enum.xml
638
- - test/reports/TEST-HammerCLI-Output-Adapter-Abstract-test-data-for-field.xml
639
- - test/reports/TEST-HammerCLI-CompleterWord-complete-.xml
640
- - test/reports/TEST-HammerCLI-Output-Output.xml
641
- - test/reports/TEST-HammerCLI-Options-OptionDefinition-formatters.xml
642
- - test/reports/TEST-HammerCLI-I18n.xml
643
- - test/reports/TEST-HammerCLI-Modules-load-a-module-module-not-found.xml
644
- - test/reports/TEST-String-indent.xml
645
- - test/reports/TEST-HammerCLI-AbstractCommand-options.xml
646
- - test/reports/TEST-HammerCLI-Output-Adapter-CSValues.xml
647
- - test/reports/TEST-constraints-HammerCLI-Validator-AnyConstraint.xml
648
- - test/reports/TEST-HammerCLI-Apipie-OptionBuilder-setting-correct-normalizers.xml
649
- - test/reports/TEST-HammerCLI-Output-Dsl-custom-fields.xml
650
- - test/reports/TEST-HammerCLI-ShellHistory.xml
651
- - test/reports/TEST-HammerCLI-Output-Adapter-Table-print-collection-column-width.xml
652
- - test/reports/TEST-HammerCLI-Output-Formatters-LongTextFormatter.xml
653
- - test/reports/TEST-HammerCLI-Output-Adapter-Base-print-collection-show-ids.xml
654
- - test/reports/TEST-Fields-Field-parameters.xml
655
- - test/reports/TEST-HammerCLI-CompleterLine-splitting-words.xml
656
- - test/reports/TEST-HammerCLI-Apipie-Command-options.xml
657
- - test/reports/TEST-String.xml
658
- - test/reports/TEST-HammerCLI-Output-Adapter-CSValues-print-collection-formatters.xml
659
- - test/reports/TEST-HammerCLI-CompleterWord.xml
660
- - test/reports/TEST-HammerCLI-Options-Normalizers.xml
661
- - test/reports/TEST-HammerCLI-CompleterLine.xml
662
- - test/reports/TEST-Fields-Field-display-.xml
663
- - test/reports/TEST-HammerCLI-Connection.xml
664
- - test/reports/TEST-HammerCLI-Options-Normalizers-json-input.xml
665
- - test/reports/TEST-HammerCLI-Output-Output-formatters.xml
666
- - test/unit/utils_test.rb
667
- - test/unit/settings_test.rb
668
- - test/unit/modules_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
409
+ - test/unit/apipie/command_test.rb
410
+ - test/unit/apipie/option_builder_test.rb
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
415
+ - test/unit/command_extensions_test.rb
416
+ - test/unit/completer_test.rb
417
+ - test/unit/connection_test.rb
418
+ - test/unit/csv_parser_test.rb
419
+ - test/unit/defaults_test.rb
420
+ - test/unit/exception_handler_test.rb
421
+ - test/unit/fixtures/apipie/architectures.json
422
+ - test/unit/fixtures/apipie/documented.json
423
+ - test/unit/fixtures/certs/ca_cert.pem
424
+ - test/unit/fixtures/certs/non_ca_cert.pem
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
669
430
  - test/unit/help/definition/abstract_item_test.rb
670
- - test/unit/help/definition/note_test.rb
671
431
  - test/unit/help/definition/list_test.rb
672
- - test/unit/help/definition/text_test.rb
432
+ - test/unit/help/definition/note_test.rb
673
433
  - test/unit/help/definition/section_test.rb
674
- - test/unit/help/builder_test.rb
675
- - test/unit/help/text_builder_test.rb
434
+ - test/unit/help/definition/text_test.rb
676
435
  - test/unit/help/definition_test.rb
677
- - test/unit/abstract_test.rb
436
+ - test/unit/help/text_builder_test.rb
437
+ - test/unit/history_test.rb
678
438
  - test/unit/i18n_test.rb
679
439
  - test/unit/logger_test.rb
680
- - test/unit/history_test.rb
681
- - test/unit/exception_handler_test.rb
682
440
  - test/unit/main_test.rb
683
- - test/unit/connection_test.rb
684
- - test/unit/output/output_test.rb
685
- - test/unit/output/fields_test.rb
686
- - test/unit/output/adapter/table_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
687
453
  - test/unit/output/adapter/abstract_test.rb
688
- - test/unit/output/adapter/yaml_test.rb
689
454
  - test/unit/output/adapter/base_test.rb
690
455
  - test/unit/output/adapter/csv_test.rb
691
456
  - test/unit/output/adapter/json_test.rb
692
- - test/unit/output/record_collection_test.rb
693
- - test/unit/output/dsl_test.rb
457
+ - test/unit/output/adapter/table_test.rb
458
+ - test/unit/output/adapter/yaml_test.rb
694
459
  - test/unit/output/definition_test.rb
460
+ - test/unit/output/dsl_test.rb
695
461
  - test/unit/output/field_filter_test.rb
462
+ - test/unit/output/fields_test.rb
696
463
  - test/unit/output/formatters_test.rb
697
- - test/unit/csv_parser_test.rb
698
- - test/unit/completer_test.rb
699
- - test/unit/apipie/api_connection_test.rb
700
- - test/unit/apipie/option_definition_test.rb
701
- - test/unit/apipie/command_test.rb
702
- - test/unit/apipie/option_builder_test.rb
703
- - test/unit/apipie/test_helper.rb
704
- - test/unit/options/option_collector_test.rb
705
- - test/unit/options/sources/saved_defaults_test.rb
706
- - test/unit/options/sources/command_line_test.rb
707
- - test/unit/options/normalizers_test.rb
708
- - test/unit/options/validators/dsl_test.rb
709
- - test/unit/options/option_definition_test.rb
710
- - test/unit/options/processor_list_test.rb
711
- - test/unit/options/matcher_test.rb
712
- - test/unit/option_builder_test.rb
713
- - test/unit/fixtures/certs/non_ca_cert.pem
714
- - test/unit/fixtures/certs/ca_cert.pem
715
- - test/unit/fixtures/json_input/invalid.json
716
- - test/unit/fixtures/json_input/valid.json
717
- - test/unit/fixtures/apipie/architectures.json
718
- - test/unit/fixtures/apipie/documented.json
719
- - test/unit/fixtures/defaults/defaults.yml
720
- - test/unit/fixtures/defaults/defaults_dashed.yml
721
- - test/unit/defaults_test.rb
722
- - test/unit/messages_test.rb
723
- - test/unit/command_extensions_test.rb
724
- - test/unit/ca_cert_manager_test.rb
464
+ - test/unit/output/output_test.rb
465
+ - test/unit/output/record_collection_test.rb
466
+ - test/unit/settings_test.rb
725
467
  - test/unit/test_helper.rb
726
- - test/functional/help_test.rb
727
- - test/functional/nil_values_test.rb
728
- - test/functional/defaults_test.rb
729
- - test/functional/test_helper.rb
730
- - test/test_helper.rb
468
+ - test/unit/utils_test.rb