Skip to content

Commit

Permalink
Add key-values format to data task
Browse files Browse the repository at this point in the history
  • Loading branch information
arjan0307 authored and glebm committed Dec 1, 2021
1 parent 2faebce commit 1b9e046
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/i18n/tasks/command/options/data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module Data
include Command::DSL

DATA_FORMATS = %w[yaml json keys].freeze
OUT_FORMATS = ['terminal-table', *DATA_FORMATS, 'inspect'].freeze
OUT_FORMATS = ['terminal-table', *DATA_FORMATS, 'inspect', 'key-values'].freeze

format_arg = proc do |type, values|
default = values.first
Expand Down Expand Up @@ -85,6 +85,8 @@ def print_forest(forest, opts, version = :show_tree)
puts forest.inspect
when 'keys'
puts forest.key_names(root: true)
when 'key-values'
puts forest.key_values(root: true).map { |kv| kv.join("\t") }
when *DATA_FORMATS
puts i18n.data.adapter_dump forest.to_hash(true), format
end
Expand Down

0 comments on commit 1b9e046

Please sign in to comment.