NAME

Getopt::Pad::Completion - shell completion scripts and their answers

DESCRIPTION

Both halves of shell completion for one Spec. renderScript($shell) returns the bash or zsh script the --create-completions trigger prints: a thin function that, on every tab, runs the program again with the GETOPT_PAD_COMPLETE environment variable set to the shell name, GETOPT_PAD_COMPLETE_INDEX set to the index of the word under the cursor, and the words after the program name as arguments. GetOptions notices the variable and prints what candidates($words, $index) returns instead of parsing: a directive line (files, dirs or none) telling the shell which of its own path completions to add, then one candidate per line. The candidates come from replaying the finished words through the Spec (commands descend a Level, options that take a value swallow the next word), and cover command names, the visible option spellings of the Level, the values an Option's valid list allows (static or produced by its coderef), and the type's path completion.

Part of the Getopt::Pad distribution; see its documentation for the user-facing API.

AUTHOR

davenonymous <perl@davenonymous.com>

COPYRIGHT AND LICENSE

Copyright 2026 davenonymous

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.