NAME

Developer::Dashboard::CLI::OpenFileChooser - interactive match chooser and editor selection for dashboard of

SYNOPSIS

use Developer::Dashboard::CLI::OpenFileChooser qw(_default_editor _editor_supports_tabs _select_open_file_matches);

DESCRIPTION

Extracted from Developer::Dashboard::CLI::OpenFile (DD-918) to keep that module under this project's 500-line-per-module guideline. Holds the editor-command resolution, the vim-family tab-flag detection, the non-interactive-safe STDIN readiness check (DD-915), and the numbered multi-match chooser prompt itself.

PURPOSE

When dashboard of resolves more than one matching file and --print was not given, this module decides how to present the choice (a numbered list), how to read an answer safely without hanging on a STDIN that will never send one, how to parse that answer into a selection (single index, comma list, or range), and which editor command (with which flags) finally opens the chosen file(s).

WHY IT EXISTS

Developer::Dashboard::CLI::OpenFile mixed CLI dispatch, this entire interactive-chooser/editor-selection concern, scope-search ranking, and Java-source lookup in one file. The chooser has no dependency on the rest of that file's search logic beyond one small shared helper (_unique_matches, provided by Developer::Dashboard::CLI::OpenFileUtil), making it a natural, low-risk seam.

WHEN TO USE

Use this file when changing how multiple matches are presented or chosen, how STDIN readiness is detected, how a chooser answer string is parsed (single index / comma list / range), or which editor flags are added for which editor.

HOW TO USE

use Developer::Dashboard::CLI::OpenFileChooser qw(_default_editor _editor_supports_tabs _select_open_file_matches);

Called by Developer::Dashboard::CLI::OpenFile's run_open_file_command once _resolve_open_file_matches has produced more than one candidate and --print was not requested.

WHAT USES IT

Developer::Dashboard::CLI::OpenFile, and this module's own coverage tests.

EXAMPLES

my $editor_cmd = _default_editor($explicit_editor_or_undef);
my @matches = _select_open_file_matches( matches => \@candidates );