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, options) ⇒ Action

Returns a new instance of Action.



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

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

Instance Method Details

#aliasObject



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

def alias
	@config["alias"]
end

#commandObject



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

def command
	@config["command"]
end

#descriptionObject



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

def description
	@config["description"]
end

#runObject



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

def run
	load_secrets if load_secrets?

	Kernel.exec(to_s)
end

#to_sObject



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

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