Sha256: c2bd93a55bf8698d49be05b1581d564d7d3d61ab63d1aa6c979eb0cdf34c2379

Contents?: true

Size: 675 Bytes

Versions: 12

Compression:

Stored size: 675 Bytes

Contents

# frozen_string_literal: true

require "optparse"

module RubyNext
  module Commands
    class Base
      class << self
        def run(args)
          new(args).run
        end
      end

      def initialize(args)
        parse! args
      end

      def parse!(*)
        raise NotImplementedError
      end

      def run
        raise NotImplementedError
      end

      def log(msg)
        return unless CLI.verbose
        $stdout.puts msg
      end

      def base_parser
        OptionParser.new do |opts|
          yield opts

          opts.on("-V", "Turn on verbose mode") do
            CLI.verbose = true
          end
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
ruby-next-core-0.6.0 lib/ruby-next/commands/base.rb
ruby-next-core-0.5.3 lib/ruby-next/commands/base.rb
ruby-next-core-0.5.2 lib/ruby-next/commands/base.rb
ruby-next-core-0.5.1 lib/ruby-next/commands/base.rb
ruby-next-core-0.5.0 lib/ruby-next/commands/base.rb
ruby-next-core-0.4.0 lib/ruby-next/commands/base.rb
ruby-next-0.3.0 lib/ruby-next/commands/base.rb
ruby-next-core-0.3.0 lib/ruby-next/commands/base.rb
ruby-next-0.2.0 lib/ruby-next/commands/base.rb
ruby-next-core-0.2.0 lib/ruby-next/commands/base.rb
ruby-next-0.1.1 lib/ruby-next/commands/base.rb
ruby-next-0.1.0 lib/ruby-next/commands/base.rb