Class: Toys::ToolDefinition::DefaultCompletion

Inherits:
Completion::Base show all
Defined in:
core-docs/toys/tool_definition.rb

Overview

Defined in the toys-core gem

A Completion that implements the default algorithm for a tool.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(complete_subtools: true, include_hidden_subtools: false, complete_args: true, complete_flags: true, complete_flag_values: true, delegation_target: nil) ⇒ DefaultCompletion

Create a completion given configuration options.

Parameters:

  • complete_subtools (Boolean) (defaults to: true)

    Whether to complete subtool names

  • include_hidden_subtools (Boolean) (defaults to: false)

    Whether to include hidden subtools (i.e. those beginning with an underscore)

  • complete_args (Boolean) (defaults to: true)

    Whether to complete positional args

  • complete_flags (Boolean) (defaults to: true)

    Whether to complete flag names

  • complete_flag_values (Boolean) (defaults to: true)

    Whether to complete flag values

  • delegation_target (Array<String>, nil) (defaults to: nil)

    Delegation target, or nil if none.



30
31
32
33
34
# File 'core-docs/toys/tool_definition.rb', line 30

def initialize(complete_subtools: true, include_hidden_subtools: false,
               complete_args: true, complete_flags: true, complete_flag_values: true,
               delegation_target: nil)
  # Source available in the toys-core gem
end

Instance Attribute Details

#delegation_targetArray<String>?

Delegation target, or nil for none.

Returns:

  • (Array<String>)

    if there is a delegation target

  • (nil)

    if there is no delegation target



81
82
83
# File 'core-docs/toys/tool_definition.rb', line 81

def delegation_target
  @delegation_target
end

Instance Method Details

#call(context) ⇒ Array<Toys::Completion::Candidate>

Returns candidates for the current completion.

Parameters:

Returns:



90
91
92
# File 'core-docs/toys/tool_definition.rb', line 90

def call(context)
  # Source available in the toys-core gem
end

#complete_args?Boolean

Whether to complete positional args

Returns:

  • (Boolean)


64
65
66
# File 'core-docs/toys/tool_definition.rb', line 64

def complete_args?
  # Source available in the toys-core gem
end

#complete_flag_values?Boolean

Whether to complete flag values

Returns:

  • (Boolean)


72
73
74
# File 'core-docs/toys/tool_definition.rb', line 72

def complete_flag_values?
  # Source available in the toys-core gem
end

#complete_flags?Boolean

Whether to complete flags

Returns:

  • (Boolean)


56
57
58
# File 'core-docs/toys/tool_definition.rb', line 56

def complete_flags?
  # Source available in the toys-core gem
end

#complete_subtools?Boolean

Whether to complete subtool names

Returns:

  • (Boolean)


40
41
42
# File 'core-docs/toys/tool_definition.rb', line 40

def complete_subtools?
  # Source available in the toys-core gem
end

#include_hidden_subtools?Boolean

Whether to include hidden subtools

Returns:

  • (Boolean)


48
49
50
# File 'core-docs/toys/tool_definition.rb', line 48

def include_hidden_subtools?
  # Source available in the toys-core gem
end