Sha256: 3b3d91db77d4d124b3932f8059b2abe460965c7615781c19474b2afadebc1741

Contents?: true

Size: 624 Bytes

Versions: 7

Compression:

Stored size: 624 Bytes

Contents

module Percheron
  module CLI
    class AbstractCommand < Clamp::Command

      DEFAULT_CONFIG_FILE = '.percheron.yml'

      option [ '-c', '--config_file' ], 'CONFIG', 'Configuration file', default: DEFAULT_CONFIG_FILE

      option '--version', :flag, 'show version' do
        puts Percheron::VERSION
        exit(0)
      end

      def default_config_file
        ENV.fetch('PERCHERON_CONFIG', DEFAULT_CONFIG_FILE)
      end

      def config
        @config ||= Percheron::Config.new(config_file)
      rescue Errors::ConfigFileInvalid => e
        $logger.error e.message
        exit(1)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
percheron-0.5.0 lib/percheron/cli/abstract_command.rb
percheron-0.4.0 lib/percheron/cli/abstract_command.rb
percheron-0.3.2 lib/percheron/cli/abstract_command.rb
percheron-0.3.1 lib/percheron/cli/abstract_command.rb
percheron-0.3.0 lib/percheron/cli/abstract_command.rb
percheron-0.2.4 lib/percheron/cli/abstract_command.rb
percheron-0.2.3 lib/percheron/cli/abstract_command.rb