Sha256: 9c752dc72138ad45e7be2de008941e19d20878610cfea3b04ef8c6809c6e525a
Contents?: true
Size: 1.18 KB
Versions: 3
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 dhall 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::Dhall.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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dotcrypt-0.1.3 | lib/dotcrypt/CLI/commands/show.rb |
dotcrypt-0.1.2 | lib/dotcrypt/CLI/commands/show.rb |
dotcrypt-0.1.0 | lib/dotcrypt/CLI/commands/show.rb |