Class: Space::Core::CLI::Run
- Inherits:
-
BaseCommand
- Object
- Dry::CLI::Command
- BaseCommand
- Space::Core::CLI::Run
- Defined in:
- lib/space_core/cli/run.rb
Instance Method Summary collapse
Methods included from Helpers
#display_date, #handle_errors, #project_config, #render, #setup_terminal, #state, #store, #terminal
Instance Method Details
#call(command: [], tty: nil, env: [], **opts) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/space_core/cli/run.rb', line 14 def call(command: [], tty: nil, env: [], **opts) setup_terminal(**opts.slice(:color, :colors)) handle_errors do result = store.current.bind do |space| runner = Space::Core::OciRunner.new( space: space, interactive: tty.nil? ? CLI.tty?(out) : tty, env_vars: env ) runner.command(command).fmap { |argv| { argv: argv, runner: runner } } end render(result) do |r| r[:runner].host_dirs.each { |d| FileUtils.mkdir_p(d) } warn_missing_env(r[:runner].missing_env) terminal.say "Running: #{r[:argv].join(' ')}" out.flush # Kernel.exec replaces the process without flushing buffered IO Kernel.exec(*r[:argv]) end end end |