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.9.7 lib/metanorma/cli/thor_with_config.rb
metanorma-cli-1.9.6 lib/metanorma/cli/thor_with_config.rb
metanorma-cli-1.9.5 lib/metanorma/cli/thor_with_config.rb
metanorma-cli-1.9.4 lib/metanorma/cli/thor_with_config.rb
metanorma-cli-1.9.3 lib/metanorma/cli/thor_with_config.rb
metanorma-cli-1.9.2 lib/metanorma/cli/thor_with_config.rb
metanorma-cli-1.9.1 lib/metanorma/cli/thor_with_config.rb
metanorma-cli-1.9.0 lib/metanorma/cli/thor_with_config.rb
metanorma-cli-1.8.11 lib/metanorma/cli/thor_with_config.rb
metanorma-cli-1.8.10 lib/metanorma/cli/thor_with_config.rb
metanorma-cli-1.8.9 lib/metanorma/cli/thor_with_config.rb
metanorma-cli-1.8.8 lib/metanorma/cli/thor_with_config.rb
metanorma-cli-1.8.8.pre lib/metanorma/cli/thor_with_config.rb
metanorma-cli-1.8.7 lib/metanorma/cli/thor_with_config.rb
metanorma-cli-1.8.7.pre lib/metanorma/cli/thor_with_config.rb
metanorma-cli-1.8.6 lib/metanorma/cli/thor_with_config.rb
metanorma-cli-1.8.6.pre lib/metanorma/cli/thor_with_config.rb
metanorma-cli-1.8.5 lib/metanorma/cli/thor_with_config.rb
metanorma-cli-1.8.5.pre.pre lib/metanorma/cli/thor_with_config.rb
metanorma-cli-1.8.4 lib/metanorma/cli/thor_with_config.rb