Sha256: bee0b76d5411b114944db6827fa7b94d12747069f342f115330e0d9f2b8cd43f

Contents?: true

Size: 763 Bytes

Versions: 1

Compression:

Stored size: 763 Bytes

Contents

# frozen_string_literal: true

require 'forwardable'

module Railsbytes
  class Command
    extend Forwardable

    def_delegators :command, :run

    # Execute this command
    #
    # @api public
    def execute(*)
      raise(
        NotImplementedError,
        "#{self.class}##{__method__} must be implemented"
      )
    end

    # The interactive prompt
    #
    # @see http://www.rubydoc.info/gems/tty-prompt
    #
    # @api public
    def prompt(**options)
      require 'tty-prompt'
      TTY::Prompt.new(**options)
    end

    # The external commands runner
    #
    # @see http://www.rubydoc.info/gems/tty-command
    #
    # @api public
    def command(**options)
      require 'tty-command'
      TTY::Command.new(**options)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
railsbytes-0.1.1 lib/railsbytes/command.rb