#!/usr/bin/env perl

use strict;
use warnings;

use FindBin qw($Bin);
use lib "$Bin/../lib";

use Developer::Dashboard::CLI::Query qw(run_query_command);

# main(@ARGV)
# Runs the CSV query command for Developer Dashboard.
# Input: command-line arguments from @ARGV and optional STDIN.
# Output: prints the selected CSV value, then exits.
run_query_command( command => 'csvq', args => \@ARGV );

__END__

=pod

=head1 NAME

csvq - CSV query command for Developer Dashboard

=head1 SYNOPSIS

  dashboard csvq [path] [file]

=head1 DESCRIPTION

This command provides CSV row and column extraction for Developer Dashboard.

=for comment FULL-POD-DOC START

=head1 PURPOSE

This staged helper owns the public C<dashboard csvq> command. It accepts an
optional row-and-column path plus an optional input file, then hands the
request to the shared query runtime so parsing, file-vs-STDIN handling, and
output formatting stay consistent with the rest of the dashboard toolchain.

=head1 WHY IT EXISTS

It exists because the dashboard ships a private, repo-local CSV inspection tool instead of depending on a globally installed parser binary. Keeping C<csvq> as a staged helper also preserves the thin-switchboard contract in C<bin/dashboard>.

=head1 WHEN TO USE

Use this file when you are changing how C<dashboard csvq> chooses between STDIN and files, how it reports parse errors, or how the staged helper is wired into the shared query implementation.

=head1 HOW TO USE

Users run C<dashboard csvq [path] [file]>. The staged helper selects the CSV
backend in the shared query runtime, which accepts the file and path in either
order, reads STDIN when no file is given, and treats the dotted path as
C<row.column> indexes such as C<1.1>. Use C<$d> or C<.> to print the entire
parsed row array as JSON.

=head1 WHAT USES IT

It is used by the public C<dashboard csvq> command, by shell snippets that want a runtime-local CSV query tool, by integration smoke runs, and by the focused query-helper coverage under C<t/>.

=head1 EXAMPLES

  printf 'alpha,beta\n7,8\n' | dashboard csvq 1.1
  dashboard csvq data.csv '$d'
  dashboard csvq '$d' data.csv
  printf 'name,status\ndemo,ok\n' | dashboard csvq 1.0

=for comment FULL-POD-DOC END

=cut
