Class: Teems::Commands::Base

Inherits:
Object
  • Object
show all
Includes:
CommandOutput, CommandValidation
Defined in:
lib/teems/commands/base.rb

Overview

Base class for all CLI commands with option parsing and output helpers

Direct Known Subclasses

Activity, Auth, Cal, Channels, Chats, Help, Meeting, Messages, Ooo, Org, Status, Sync, Who

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args, runner:) ⇒ Base

Returns a new instance of Base.



54
55
56
57
58
59
60
# File 'lib/teems/commands/base.rb', line 54

def initialize(args, runner:)
  @runner = runner
  @options = default_options
  @unknown_options = []
  @positional_args = []
  parse_options(args)
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



52
53
54
# File 'lib/teems/commands/base.rb', line 52

def options
  @options
end

#positional_argsObject (readonly)

Returns the value of attribute positional_args.



52
53
54
# File 'lib/teems/commands/base.rb', line 52

def positional_args
  @positional_args
end

#runnerObject (readonly)

Returns the value of attribute runner.



52
53
54
# File 'lib/teems/commands/base.rb', line 52

def runner
  @runner
end

Instance Method Details

#executeObject

Raises:

  • (NotImplementedError)


62
63
64
# File 'lib/teems/commands/base.rb', line 62

def execute
  raise NotImplementedError, 'Subclass must implement #execute'
end