Sha256: 30a88f75f16bb72b169136ba71a46f95b6ae237102a90e314c1156781ef33abe

Contents?: true

Size: 759 Bytes

Versions: 1

Compression:

Stored size: 759 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.0 lib/railsbytes/command.rb