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.

## Constant Summary

@@j_api_type =

      Object.new

## Class Method Summary (collapse)

- + (Boolean) accept?(obj)
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)

## Instance Method Summary (collapse)

- - (Array<String>) args
  The actual string arguments of the command.
- - (Array<::VertxShell::CliToken>) args_tokens
  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
  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?
  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.
- - (Fixnum) height
  The current height, i.e the number of columns or if unknown.
- - (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
  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.
- - (String) type
  The declared tty type, for instance , , etc...
- - (::Vertx::Vertx) vertx
  The current Vert.x instance.
- - (Fixnum) width
  The current width, i.e the number of rows or if unknown.
- - (self) write(data = nil)
  Write some text to the standard output.

## Class Method Details

### + (`Boolean`) accept?(obj)

Returns:

- (`Boolean`)

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

    def @@j_api_type.accept?(obj)
      obj.class == CommandProcess
    end

### + (`Object`) j_api_type

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

    def self.j_api_type
      @@j_api_type
    end

### + (`Object`) j_class

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

    def self.j_class
      Java::IoVertxExtShellCommand::CommandProcess.java_class
    end

### + (`Object`) unwrap(obj)

    29
    30
    31
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/command_process.rb', line 29

    def @@j_api_type.unwrap(obj)
      obj.j_del
    end

### + (`Object`) wrap(obj)

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

    def @@j_api_type.wrap(obj)
      CommandProcess.new(obj)
    end

## Instance Method Details

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

Returns the actual string arguments of the command

Returns:

- (`Array<String>`) —
  the actual string arguments of the command

Raises:

- (`ArgumentError`)

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

    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

Returns the unparsed arguments tokens

Returns:

- (`Array<::VertxShell::CliToken>`) —
  the unparsed arguments tokens

Raises:

- (`ArgumentError`)

    67
    68
    69
    70
    71
    72
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/command_process.rb', line 67

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

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

    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

Returns the command line object or null

Returns:

- (`::Vertx::CommandLine`) —
  the command line object or null

Raises:

- (`ArgumentError`)

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

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

    196
    197
    198
    199
    200
    201
    202
    203
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/command_process.rb', line 196

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

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

    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?

Returns true if the command is running in foreground

Returns:

- (`true`, `false`) —
  true if the command is running in foreground

Raises:

- (`ArgumentError`)

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

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

    177
    178
    179
    180
    181
    182
    183
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/command_process.rb', line 177

    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

### - (`Fixnum`) height

Returns the current height, i.e the number of columns or if unknown

Returns:

- (`Fixnum`) —
  the current height, i.e the number of columns or if unknown

Raises:

- (`ArgumentError`)

    53
    54
    55
    56
    57
    58
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/command_process.rb', line 53

    def height
      if !block_given?
        return @j_del.java_method(:height, []).call()
      end
      raise ArgumentError, "Invalid arguments when calling height()"
    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`)

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

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

    186
    187
    188
    189
    190
    191
    192
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/command_process.rb', line 186

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

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

Returns the shell session

Returns:

- (`::VertxShell::Session`) —
  the shell session

Raises:

- (`ArgumentError`)

    88
    89
    90
    91
    92
    93
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/command_process.rb', line 88

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

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

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

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

    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

### - (`String`) type

Returns the declared tty type, for instance , , etc... it can be null when the tty does not have declared its type.

Returns:

- (`String`) —
  the declared tty type, for instance , , etc... it can be null when the tty does not have declared its type.

Raises:

- (`ArgumentError`)

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

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

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

Returns the current Vert.x instance

Returns:

- (`::Vertx::Vertx`) —
  the current Vert.x instance

Raises:

- (`ArgumentError`)

    60
    61
    62
    63
    64
    65
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/command_process.rb', line 60

    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

### - (`Fixnum`) width

Returns the current width, i.e the number of rows or if unknown

Returns:

- (`Fixnum`) —
  the current width, i.e the number of rows or if unknown

Raises:

- (`ArgumentError`)

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

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

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

Write some text to the standard output.

Parameters:

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

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

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

    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