Class List Method List File List

# Class: VertxShell::CommandProcess

Inherits:
  Tty
  - Object
  - Tty
  - VertxShell::CommandProcess
  show all
Defined in:
  /Users/julien/java/vertx-aggregator/modules/vertx-shell/src/main/resources/vertx-shell/command_process.rb

## Overview

The command process provides interaction with the process of the command provided by Vert.x Shell.

## Instance Method Summary (collapse)

- - (Array<String>) args
  @return the actual string arguments of the command.
- - (Array<::VertxShell::CliToken>) args_tokens
  @return the unparsed arguments tokens.
- - (::Vertx::CommandLine) command_line
  @return the command line object or null.
- - (void) end(status = nil)
  End the process.
- - (self) event_handler(eventType = nil) { ... }
- - (::VertxShell::Session) session
  @return the shell session.
- - (self) set_stdin(stdin = nil)
- - (::Vertx::Vertx) vertx
  @return the current Vert.x instance.
- - (self) write(text = nil)

### Methods inherited from Tty

#height, #stdout, #width

## Instance Method Details

### - (`Array<String>`) args

@return the actual string arguments of the command

Returns:

- (`Array<String>`)

Raises:

- (`ArgumentError`)

    41
    42
    43
    44
    45
    46
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-shell/src/main/resources/vertx-shell/command_process.rb', line 41

    def args
      if !block_given?
        return @j_del.java_method(:args, []).call().to_a.map { |elt| elt }
      end
      raise ArgumentError, "Invalid arguments when calling args()"
    end

### - (`Array<::VertxShell::CliToken>`) args_tokens

@return the unparsed arguments tokens

Returns:

- (`Array<::VertxShell::CliToken>`)

Raises:

- (`ArgumentError`)

    33
    34
    35
    36
    37
    38
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-shell/src/main/resources/vertx-shell/command_process.rb', line 33

    def args_tokens
      if !block_given?
        return @j_del.java_method(:argsTokens, []).call().to_a.map { |elt| ::Vertx::Util::Utils.safe_create(elt,::VertxShell::CliToken) }
      end
      raise ArgumentError, "Invalid arguments when calling args_tokens()"
    end

### - (`::Vertx::CommandLine`) command_line

@return the command line object or null

Returns:

- (`::Vertx::CommandLine`)

Raises:

- (`ArgumentError`)

    49
    50
    51
    52
    53
    54
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-shell/src/main/resources/vertx-shell/command_process.rb', line 49

    def command_line
      if !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:commandLine, []).call(),::Vertx::CommandLine)
      end
      raise ArgumentError, "Invalid arguments when calling command_line()"
    end

### - (`void`) end(status = nil)

This method returns an undefined value.

End the process.

Parameters:

- status (`Fixnum`) (defaults to: `nil`) —
  the exit status.

Raises:

- (`ArgumentError`)

    94
    95
    96
    97
    98
    99
    100
    101
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-shell/src/main/resources/vertx-shell/command_process.rb', line 94

    def end(status=nil)
      if !block_given? && status == nil
        return @j_del.java_method(:end, []).call()
      elsif status.class == Fixnum && !block_given?
        return @j_del.java_method(:end, [Java::int.java_class]).call(status)
      end
      raise ArgumentError, "Invalid arguments when calling end(status)"
    end

### - (`self`) event_handler(eventType = nil) { ... }

Parameters:

- eventType (`:SIGTSTP`, `:EOF`, `:SIGINT`, `:SIGWINCH`, `:SIGCONT`) (defaults to: `nil`)

Yields:

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    75
    76
    77
    78
    79
    80
    81
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-shell/src/main/resources/vertx-shell/command_process.rb', line 75

    def event_handler(eventType=nil)
      if eventType.class == Symbol && block_given?
        @j_del.java_method(:eventHandler, [Java::IoVertxExtShellIo::EventType.java_class,Java::IoVertxCore::Handler.java_class]).call(Java::IoVertxExtShellIo::EventType.valueOf(eventType),Proc.new { yield })
        return self
      end
      raise ArgumentError, "Invalid arguments when calling event_handler(eventType)"
    end

### - (`::VertxShell::Session`) session

@return the shell session

Returns:

- (`::VertxShell::Session`)

Raises:

- (`ArgumentError`)

    57
    58
    59
    60
    61
    62
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-shell/src/main/resources/vertx-shell/command_process.rb', line 57

    def session
      if !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:session, []).call(),::VertxShell::Session)
      end
      raise ArgumentError, "Invalid arguments when calling session()"
    end

### - (`self`) set_stdin(stdin = nil)

Parameters:

- stdin (`::VertxShell::Stream`) (defaults to: `nil`)

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    65
    66
    67
    68
    69
    70
    71
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-shell/src/main/resources/vertx-shell/command_process.rb', line 65

    def set_stdin(stdin=nil)
      if stdin.class.method_defined?(:j_del) && !block_given?
        @j_del.java_method(:setStdin, [Java::IoVertxExtShellIo::Stream.java_class]).call(stdin.j_del)
        return self
      end
      raise ArgumentError, "Invalid arguments when calling set_stdin(stdin)"
    end

### - (`::Vertx::Vertx`) vertx

@return the current Vert.x instance

Returns:

- (`::Vertx::Vertx`)

Raises:

- (`ArgumentError`)

    25
    26
    27
    28
    29
    30
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-shell/src/main/resources/vertx-shell/command_process.rb', line 25

    def vertx
      if !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:vertx, []).call(),::Vertx::Vertx)
      end
      raise ArgumentError, "Invalid arguments when calling vertx()"
    end

### - (`self`) write(text = nil)

Parameters:

- text (`String`) (defaults to: `nil`)

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    84
    85
    86
    87
    88
    89
    90
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-shell/src/main/resources/vertx-shell/command_process.rb', line 84

    def write(text=nil)
      if text.class == String && !block_given?
        @j_del.java_method(:write, [Java::java.lang.String.java_class]).call(text)
        return self
      end
      raise ArgumentError, "Invalid arguments when calling write(text)"
    end