Sha256: d33986053d959cd8867713af25dffbdb437eaf586cf4cb4f69f5f61178d2d787
Contents?: true
Size: 1.18 KB
Versions: 1
Compression:
Stored size: 1.18 KB
Contents
# frozen_string_literal: true module Dotcrypt::Cli::Commands::Show def self.included(thor) # rubocop:disable Metrics/MethodLength thor.class_eval do include Dotcrypt::Cli::Commands::Globals desc "show", "converts a jsonnet file into various formats" option :output, aliases: :o, type: :string, enum: Dotcrypt::Serializers::SERIALIZERS.keys.map(&:to_s), default: "yaml", desc: "Output format." option :flatten, aliases: :l, type: :boolean, default: false, desc: "Whether to flatten the output. Always enabled for `env` format" def show = Handler.new(**options).call end end class Handler def initialize(**options) @options = options end def call = print(serializer.call(config)) private def config @config ||= Dotcrypt::Jsonnet.load_from(@options[:file]).then do |c| next Dotcrypt::Flattener.call(c, separator: @options[:separator]) if @options[:flatten] c end end def serializer = Dotcrypt::Serializers.for(@options[:output]) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dotcrypt-0.2.0 | lib/dotcrypt/CLI/commands/show.rb |