Class: Cliqr::Command::ShellCommand Private

Inherits:
BaseCommand show all
Defined in:
lib/cliqr/command/shell_command.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

The default command executed to run a shell action

Instance Method Summary collapse

Constructor Details

#initialize(shell_config) ⇒ ShellCommand

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Create a new shell command handler



11
12
13
# File 'lib/cliqr/command/shell_command.rb', line 11

def initialize(shell_config)
  @shell_config = shell_config
end

Instance Method Details

#execute(context) ⇒ Integer

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Start a shell in the context of some other command

Returns:

  • (Integer)

    Exit code



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/cliqr/command/shell_command.rb', line 18

def execute(context)
  validate_environment(context)

  root_context = context.root(:shell)

  puts banner(root_context, build_proc(@shell_config.banner))

  context.invoke(:shell_start)
  exit_code = build_runner(context, root_context).run
  context.invoke(:shell_stop)
  puts "shell exited with code #{exit_code}"
  exit_code
end