NAME
csvq - CSV query command for Developer Dashboard
SYNOPSIS
d2 csvq [path] [file]
DESCRIPTION
This command provides CSV query extraction for Developer Dashboard.
PURPOSE
This staged helper owns the public d2 csvq command. It accepts an optional row-and-column path or $d-based Perl expression 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.
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 csvq as a staged helper also preserves the thin-switchboard contract in bin/d2.
WHEN TO USE
Use this file when you are changing how d2 csvq chooses between STDIN and files, how it reports parse errors, or how the staged helper is wired into the shared query implementation.
HOW TO USE
Users run d2 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 row.column indexes such as 1.1. Use $d or . to print the entire parsed row array as JSON. If the query text uses $d inside a Perl expression, the helper evaluates that expression against the decoded CSV rows before formatting the result.
WHAT USES IT
It is used by the public d2 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 t/.
EXAMPLES
printf 'alpha,beta\n7,8\n' | d2 csvq 1.1
d2 csvq data.csv '$d'
d2 csvq '$d' data.csv
printf 'name,count\nfoo,7\nbar,8\n' | d2 csvq 'join q(-), map { $d->[1][$_] } 0 .. $#{$d->[1]}'
printf 'name,status\ndemo,ok\n' | d2 csvq 1.0