NAME
Developer::Dashboard::CLI::Complete - shell completion candidates for dashboard
SYNOPSIS
use Developer::Dashboard::CLI::Complete;
my @candidates = Developer::Dashboard::CLI::Complete::complete(
words => [ 'dashboard', 'do' ],
index => 1,
);
DESCRIPTION
Builds completion candidates for dashboard subcommands, built-in second-level actions, option flags, global help targets, dotted skill commands, and workspace path aliases. Commands and aliases are separated by argument position so dotted path names do not appear among command candidates.
PURPOSE
This module centralizes shell-completion candidate generation for dashboard and the d2 shortcut. It exposes top-level built-ins, layered custom commands, dotted installed skill commands, and nested built-in actions through one reusable API. Command and option candidates are read from the shared help catalog; global dashboard help completion follows the same nested action tree. Docker completion lists compose, list, enable, disable, and development, then offers enable and disable after docker development. Workspace names and configured or skill-provided path aliases are queried only for positional completion; option completion does not invoke the tmux session provider or path alias providers.
WHY IT EXISTS
It exists because shell completion should not hardcode command lists inside the generated shell snippets. Keeping completion discovery in Perl lets the shell bootstrap ask the live DD-OOP-LAYERS runtime what commands and skills are available. Dotted skill-command candidates are kept separate from path aliases; path aliases are offered after workspace, where they are valid targets. After a command name, the help catalog provides valid public actions and recognized option spellings, avoiding a second shell-side inventory.
WHEN TO USE
Use this file when changing shell completion behavior, the exposed subcommand lists, or the interaction between tab completion and installed skills.
HOW TO USE
Call complete(words => \@words, index => $n) with the command-line snapshot the shell provided. The returned list is meant to be printed one entry per line by the private completion helper.
WHAT USES IT
It is used by the private dashboard complete helper, by generated bash and zsh shell bootstraps, and by shell-smoke regression tests that pin the tab completion contract.
EXAMPLES
Example 1:
perl -Ilib -MDeveloper::Dashboard::CLI::Complete -e 'print join qq(\n), Developer::Dashboard::CLI::Complete::complete(words => [qw(dashboard do)], index => 1)'
Preview top-level completion candidates from a source checkout.
Example 2:
perl -Ilib -MDeveloper::Dashboard::CLI::Complete -e 'print join qq(\n), Developer::Dashboard::CLI::Complete::complete(words => [qw(dashboard docker co)], index => 2)'
Preview second-level completion candidates for one built-in command.
Example 3:
perl -Ilib -MDeveloper::Dashboard::CLI::Complete -e 'print join qq(\n), Developer::Dashboard::CLI::Complete::complete(words => [qw(d2 docker development)], index => 3)'
Preview the nested Docker development actions.
Example 4:
prove -lv t/05-cli-smoke.t
Run the focused shell-completion regression tests.
Example 5:
prove -lr t
Recheck completion behavior inside the full repository suite before release.
Example 6:
dashboard complete 3 dashboard api add -
Print option candidates for the API add action, including long options, short aliases, and the explicit help flags.