civicrm / cv

CiviCRM CLI Utility
28 stars 30 forks source link

Tabular Outputs - Expand support for "all columns" (and other shortcuts) #213

Closed totten closed 2 months ago

totten commented 2 months ago

Synopsis

Many subcommands produce some kind of tabular data-set for output. The default tables are designed to be generally useful. But for more advanced cases, the output can be customized to use particular columns and output-formats.

This branches provides more options to help with those advanced. In particular, the option -a (--all-columns) can help inspect output. Additionally, it reduces some duplicate code to further standardize behavior of more commands.

## Print summary of extensions; then all details; then custom listings
cv ext:list
cv ext:list -a | less
cv ext:list --out=csv --columns=key,version
cv ext:list -R -I --columns=downloadUrl | grep githu

## Print summary of settings; then all details; then custom listings
cv vget
cv vget -a | less
cv vget --out=csv --columns=key,value,meta.default

(Note that -a is a bit different from -v. "Verbose" output enables more logging throughout the execution of the job. "All Columns" enables a full view of the final result-set.)

Technical Details

This includes some work on extractions, refactorings, helpers. The big one is sendStandardTable(). This is like sendTable() used here-to-fore, but it enforces some standardized behaviors for column-selection and sorting.