Sha256: c8ad7523b3c6569055136d59d46a7008e98c4d3c0716bf2507841f57274e117b

Contents?: true

Size: 687 Bytes

Versions: 1

Compression:

Stored size: 687 Bytes

Contents

module Matchd::CLI
  # A little patch to allow a "class_option" for letting Matchd be configured
  # using the given or default config file
  module ConfigFileOption
    def self.included(receiver)
      receiver.class_exec do
        class_option :config,
          type: :string,
          aliases: "-c",
          group: :runtime,
          default: Matchd::Config::DEFAULT_CONFIG_FILE,
          desc: "The config file to read"

        no_commands do
          def initialize(args = [], local_options = {}, config = {})
            super
            Matchd.configure_from_file!(options[:config]) if File.file?(options[:config])
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
matchd-0.1.0 lib/matchd/cli/config_file_option.rb