Class: Action

Inherits:
Object
  • Object
show all
Defined in:
lib/action.rb

Overview

represents one action to be performed in the shell can assemble a command line from a command and args

Instance Method Summary collapse

Constructor Details

#initialize(config, args) ⇒ Action

Returns a new instance of Action.



8
9
10
11
# File 'lib/action.rb', line 8

def initialize(config, args)
  @config = config
  @args = args
end

Instance Method Details

#aliasObject



23
24
25
# File 'lib/action.rb', line 23

def alias
  @config["alias"]
end

#commandObject



27
28
29
# File 'lib/action.rb', line 27

def command
  @config["command"]
end

#descriptionObject



31
32
33
# File 'lib/action.rb', line 31

def description
  @config["description"]
end

#runObject



13
14
15
16
17
# File 'lib/action.rb', line 13

def run
  Secrets.load if load_secrets?

  Kernel.exec(to_s)
end

#to_sObject



19
20
21
# File 'lib/action.rb', line 19

def to_s
  "#{command} #{@args.join(' ')}"
end