Class: Dip::Commands::Run

Inherits:
Dip::Command show all
Defined in:
lib/dip/commands/run.rb

Instance Method Summary collapse

Methods inherited from Dip::Command

exec_program, exec_subprocess

Constructor Details

#initialize(cmd, *argv, **options) ⇒ Run

Returns a new instance of Run.

Raises:



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/dip/commands/run.rb', line 16

def initialize(cmd, *argv, **options)
  @options = options

  @command, @argv = InteractionTree
    .new(Dip.config.interaction)
    .find(cmd, *argv)&.values_at(:command, :argv)

  raise Dip::Error, "Command `#{[cmd, *argv].join(" ")}` not recognized!" unless command

  Dip.env.merge(command[:environment])
end

Instance Method Details

#executeObject



28
29
30
31
32
# File 'lib/dip/commands/run.rb', line 28

def execute
  lookup_runner
    .new(command, argv, **options)
    .execute
end