From 1b9e0465e984df8f7890f620b0bbb6646d40d77f Mon Sep 17 00:00:00 2001 From: Arjan Diepenbroek <arjan0307@gmail.com> Date: Fri, 26 Nov 2021 12:06:00 +0100 Subject: [PATCH] Add key-values format to data task --- lib/i18n/tasks/command/options/data.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/i18n/tasks/command/options/data.rb b/lib/i18n/tasks/command/options/data.rb index aea1e0f1..add03e5e 100644 --- a/lib/i18n/tasks/command/options/data.rb +++ b/lib/i18n/tasks/command/options/data.rb @@ -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 @@ -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