Class List Method List File List

# Class: VertxShell::Command

Inherits:
  Object
  - Object
  - VertxShell::Command
  show all
Defined in:
  /Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/command.rb

## Overview

A Vert.x Shell command, it can be created from any language using the VertxShell::CommandBuilder#command or from a Java class using #create

## Instance Method Summary (collapse)

- - (::Vertx::CLI) cli
  @return the command line interface, can be null.
- - (void) complete(completion = nil)
  Perform command completion, when the command is done completing it should call or )} method to signal completion is done..
- - (::VertxShell::Process) create_process(args = nil)
  Create a new process with the passed arguments.
- - (String) name
  @return the command name.

## Instance Method Details

### - (`::Vertx::CLI`) cli

@return the command line interface, can be null

Returns:

- (`::Vertx::CLI`)

Raises:

- (`ArgumentError`)

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

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

### - (`void`) complete(completion = nil)

This method returns an undefined value.

Perform command completion, when the command is done completing it should call or )} method to signal completion is done.

Parameters:

- completion (`::VertxShell::Completion`) (defaults to: `nil`) —
  the completion object

Raises:

- (`ArgumentError`)

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

    def complete(completion=nil)
      if completion.class.method_defined?(:j_del) && !block_given?
        return @j_del.java_method(:complete, [Java::IoVertxExtShellCli::Completion.java_class]).call(completion.j_del)
      end
      raise ArgumentError, "Invalid arguments when calling complete(completion)"
    end

### - (`::VertxShell::Process`) create_process(args = nil)

Create a new process with the passed arguments.

Parameters:

- args (`Array<::VertxShell::CliToken>`) (defaults to: `nil`) —
  the process arguments

Returns:

- (`::VertxShell::Process`) —
  the process

Raises:

- (`ArgumentError`)

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

    def create_process(args=nil)
      if !block_given? && args == nil
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:createProcess, []).call(),::VertxShell::Process)
      elsif args.class == Array && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:createProcess, [Java::JavaUtil::List.java_class]).call(args.map { |element| element.j_del }),::VertxShell::Process)
      end
      raise ArgumentError, "Invalid arguments when calling create_process(args)"
    end

### - (`String`) name

@return the command name

Returns:

- (`String`)

Raises:

- (`ArgumentError`)

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

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