View Source DoIt.Completion (do_it v0.7.0)

Provides shell auto-completion functionality for DoIt CLI applications.

This module generates completion scripts for popular shells (bash, fish, zsh) and provides the completion logic for commands, subcommands, options, and arguments.

Summary

Functions

Completes values for command arguments.

Provides completions for the given command line arguments.

Completes values for a specific option.

Lists all available completions for debugging purposes.

Generates a bash completion script for the given main module and app name.

Generates a fish completion script for the given main module and app name.

Generates a zsh completion script for the given main module and app name.

Gets installation instructions for shell completion.

Parses the completion context from command line arguments.

Functions

Link to this function

complete_argument_value(main_module, arg_index, command_path)

View Source

Completes values for command arguments.

Link to this function

complete_command(main_module, args)

View Source

Provides completions for the given command line arguments.

This is the main entry point called by shell completion scripts.

Link to this function

complete_option_value(main_module, option_name, command_path)

View Source

Completes values for a specific option.

Link to this function

debug_completions(main_module)

View Source

Lists all available completions for debugging purposes.

Link to this function

generate_bash_completion(main_module, app_name)

View Source

Generates a bash completion script for the given main module and app name.

Link to this function

generate_fish_completion(main_module, app_name)

View Source

Generates a fish completion script for the given main module and app name.

Link to this function

generate_zsh_completion(main_module, app_name)

View Source

Generates a zsh completion script for the given main module and app name.

Link to this function

get_installation_instructions(app_name, shell)

View Source

Gets installation instructions for shell completion.

Link to this function

parse_completion_context(main_module, args)

View Source

Parses the completion context from command line arguments.

Returns one of:

  • {:command, command_path} - completing a command or subcommand
  • {:partial_command, partial, command_path} - completing a partial command
  • {:option_value, option_name, command_path} - completing an option value
  • {:argument, arg_index, command_path} - completing an argument
  • {:partial_option, partial, command_path} - completing a partial option