Class List Method List File List

# Class: VertxShell::CommandProcess

Inherits:
  Tty
  - Object
  - Tty
  - VertxShell::CommandProcess
  show all
Defined in:
  /Users/julien/java/vertx-stack/stack-docs/target/rb/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.
- - (self) background_handler { ... }
  Set a background handler, this handler is called when the command is running and put to background.
- - (::Vertx::CommandLine) command_line
  @return the command line object or null.
- - (void) end(status = nil)
  End the process.
- - (self) end_handler { ... }
  Set an end handler, this handler is called when the command is ended, for instance the command is running and the shell closes.
- - (true, false) foreground?
  @return true if the command is running in foreground.
- - (self) foreground_handler { ... }
  Set a foreground handler, this handler is called when the command is running and put to foreground.
- - (self) interrupt_handler { ... }
  Set an interrupt handler, this handler is called when the command is interrupted, for instance user press Ctrl-C.
- - (self) resizehandler { ... }
- - (self) resume_handler { ... }
  Set a resume handler, this handler is called when the command is resumed, for instance user types bg or fg to resume the command.
- - (::VertxShell::Session) session
  @return the shell session.
- - (self) stdin_handler { ... }
- - (self) suspend_handler { ... }
  Set a suspend handler, this handler is called when the command is suspended, for instance user press Ctrl-Z.
- - (::Vertx::Vertx) vertx
  @return the current Vert.x instance.
- - (self) write(data = nil)
  Write some text to the standard output.

### Methods inherited from Tty

#height, #type, #width

## Instance Method Details

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

@return the actual string arguments of the command

Returns:

- (`Array<String>`)

Raises:

- (`ArgumentError`)

    40
    41
    42
    43
    44
    45
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/command_process.rb', line 40

    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`)

    32
    33
    34
    35
    36
    37
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/command_process.rb', line 32

    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

### - (`self`) background_handler { ... }

Set a background handler, this handler is called when the command is running and put to background.

Yields:

- the background handler

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    136
    137
    138
    139
    140
    141
    142
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/command_process.rb', line 136

    def background_handler
      if block_given?
        @j_del.java_method(:backgroundHandler, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield })
        return self
      end
      raise ArgumentError, "Invalid arguments when calling background_handler()"
    end

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

@return the command line object or null

Returns:

- (`::Vertx::CommandLine`)

Raises:

- (`ArgumentError`)

    48
    49
    50
    51
    52
    53
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/command_process.rb', line 48

    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`)

    165
    166
    167
    168
    169
    170
    171
    172
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/command_process.rb', line 165

    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`) end_handler { ... }

Set an end handler, this handler is called when the command is ended, for instance the command is running and the shell closes.

Yields:

- the end handler

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    116
    117
    118
    119
    120
    121
    122
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/command_process.rb', line 116

    def end_handler
      if block_given?
        @j_del.java_method(:endHandler, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield })
        return self
      end
      raise ArgumentError, "Invalid arguments when calling end_handler()"
    end

### - (`true`, `false`) foreground?

@return true if the command is running in foreground

Returns:

- (`true`, `false`)

Raises:

- (`ArgumentError`)

    64
    65
    66
    67
    68
    69
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/command_process.rb', line 64

    def foreground?
      if !block_given?
        return @j_del.java_method(:isForeground, []).call()
      end
      raise ArgumentError, "Invalid arguments when calling foreground?()"
    end

### - (`self`) foreground_handler { ... }

Set a foreground handler, this handler is called when the command is running and put to foreground.

Yields:

- the foreground handler

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    146
    147
    148
    149
    150
    151
    152
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/command_process.rb', line 146

    def foreground_handler
      if block_given?
        @j_del.java_method(:foregroundHandler, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield })
        return self
      end
      raise ArgumentError, "Invalid arguments when calling foreground_handler()"
    end

### - (`self`) interrupt_handler { ... }

Set an interrupt handler, this handler is called when the command is interrupted, for instance user press `Ctrl-C`.

Yields:

- the interrupt handler

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    83
    84
    85
    86
    87
    88
    89
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/command_process.rb', line 83

    def interrupt_handler
      if block_given?
        @j_del.java_method(:interruptHandler, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield })
        return self
      end
      raise ArgumentError, "Invalid arguments when calling interrupt_handler()"
    end

### - (`self`) resizehandler { ... }

Yields:

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    155
    156
    157
    158
    159
    160
    161
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/command_process.rb', line 155

    def resizehandler
      if block_given?
        @j_del.java_method(:resizehandler, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield })
        return self
      end
      raise ArgumentError, "Invalid arguments when calling resizehandler()"
    end

### - (`self`) resume_handler { ... }

Set a resume handler, this handler is called when the command is resumed, for instance user types `bg` or `fg` to resume the command.

Yields:

- the interrupt handler

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    105
    106
    107
    108
    109
    110
    111
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/command_process.rb', line 105

    def resume_handler
      if block_given?
        @j_del.java_method(:resumeHandler, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield })
        return self
      end
      raise ArgumentError, "Invalid arguments when calling resume_handler()"
    end

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

@return the shell session

Returns:

- (`::VertxShell::Session`)

Raises:

- (`ArgumentError`)

    56
    57
    58
    59
    60
    61
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/command_process.rb', line 56

    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`) stdin_handler { ... }

Yields:

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    72
    73
    74
    75
    76
    77
    78
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/command_process.rb', line 72

    def stdin_handler
      if block_given?
        @j_del.java_method(:stdinHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(event) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling stdin_handler()"
    end

### - (`self`) suspend_handler { ... }

Set a suspend handler, this handler is called when the command is suspended, for instance user press `Ctrl-Z`.

Yields:

- the interrupt handler

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    94
    95
    96
    97
    98
    99
    100
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/command_process.rb', line 94

    def suspend_handler
      if block_given?
        @j_del.java_method(:suspendHandler, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield })
        return self
      end
      raise ArgumentError, "Invalid arguments when calling suspend_handler()"
    end

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

@return the current Vert.x instance

Returns:

- (`::Vertx::Vertx`)

Raises:

- (`ArgumentError`)

    24
    25
    26
    27
    28
    29
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/command_process.rb', line 24

    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(data = nil)

Write some text to the standard output.

Parameters:

- data (`String`) (defaults to: `nil`) —
  the text

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    126
    127
    128
    129
    130
    131
    132
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/command_process.rb', line 126

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