Sha256: 1049ecae6f81cd11dd6510b7107ee9014f82c174d818a5f80c41dbbf5fdaaaae

Contents?: true

Size: 777 Bytes

Versions: 55

Compression:

Stored size: 777 Bytes

Contents

require "thor"
require "metanorma-utils"

module Metanorma
  module Cli
    class ThorWithConfig < Thor
      Hash.include Metanorma::Utils::Hash
      Array.include Metanorma::Utils::Array

      no_commands do
        def options
          original_options = super.to_hash.symbolize_all_keys
          Thor::CoreExt::HashWithIndifferentAccess.new(
            Metanorma::Cli::Commands::Config.load_configs(original_options),
          )
        end

        def filter_compile_options(options)
          copts = %w[
            agree_to_terms
            no_install_fonts
            continue_without_fonts
            no_progress
            strict
          ]
          options.select { |k, _| copts.include?(k) }.symbolize_all_keys
        end
      end
    end
  end
end

Version data entries

55 entries across 55 versions & 1 rubygems

Version Path
metanorma-cli-1.8.3 lib/metanorma/cli/thor_with_config.rb
metanorma-cli-1.8.3.pre lib/metanorma/cli/thor_with_config.rb
metanorma-cli-1.8.2 lib/metanorma/cli/thor_with_config.rb
metanorma-cli-1.8.2.pre2 lib/metanorma/cli/thor_with_config.rb
metanorma-cli-1.8.2.pre lib/metanorma/cli/thor_with_config.rb
metanorma-cli-1.8.1 lib/metanorma/cli/thor_with_config.rb
metanorma-cli-1.8.0 lib/metanorma/cli/thor_with_config.rb
metanorma-cli-1.8.0.pre2 lib/metanorma/cli/thor_with_config.rb
metanorma-cli-1.8.0.pre lib/metanorma/cli/thor_with_config.rb
metanorma-cli-1.7.6 lib/metanorma/cli/thor_with_config.rb
metanorma-cli-1.7.6.pre.pre lib/metanorma/cli/thor_with_config.rb
metanorma-cli-1.7.5 lib/metanorma/cli/thor_with_config.rb
metanorma-cli-1.7.5pre lib/metanorma/cli/thor_with_config.rb
metanorma-cli-1.7.4 lib/metanorma/cli/thor_with_config.rb
metanorma-cli-1.7.4.pre lib/metanorma/cli/thor_with_config.rb
metanorma-cli-1.7.3 lib/metanorma/cli/thor_with_config.rb
metanorma-cli-1.7.3pre lib/metanorma/cli/thor_with_config.rb
metanorma-cli-1.7.2 lib/metanorma/cli/thor_with_config.rb
metanorma-cli-1.7.2pre1 lib/metanorma/cli/thor_with_config.rb
metanorma-cli-1.7.1 lib/metanorma/cli/thor_with_config.rb