Module: Doing::Completion

Defined in:
lib/doing/completion.rb,
lib/doing/completion/zsh_completion.rb,
lib/doing/completion/bash_completion.rb,
lib/doing/completion/fish_completion.rb,
lib/doing/completion/completion_string.rb

Overview

Completion script generator

Defined Under Namespace

Modules: StringUtils Classes: BashCompletions, FishCompletions, ZshCompletions

Constant Summary collapse

OPTIONS_RX =
/(?:-(?<short>\w), )?(?:--(?:\[no-\])?(?<long>\w+)(?:=(?<arg>\w+))?)\s+- (?<desc>.*?)$/.freeze
SECTIONS_RX =
/(?m-i)^([A-Z ]+)\n([\s\S]*?)(?=\n+[A-Z]+|\Z)/.freeze
COMMAND_RX =
/^(?<cmd>[^, \t]+)(?<alias>(?:, [^, \t]+)*)?\s+- (?<desc>.*?)$/.freeze

Class Method Summary collapse

Class Method Details

.generate_completion(type: 'zsh', file: :default, link: true) ⇒ Object

Generate a completion script and output to file or stdout

Parameters:

  • type (String) (defaults to: 'zsh')

    shell to generate for (zsh|bash|fish)

  • file (String) (defaults to: :default)

    Path to save to, or 'stdout'

.get_help_sections(command = '') ⇒ Object

.install_builtin(type) ⇒ Object

Raises:

  • (InvalidArgument)

.normalize_type(type) ⇒ Object

.parse_command(command) ⇒ Object

.parse_commands(commands) ⇒ Object

.parse_option(option) ⇒ Object

.parse_options(options) ⇒ Object