Skip to content
View as Markdown
View as Markdown

@salesforce/b2c-tooling-sdk / cli / selectColumns

Function: selectColumns()

selectColumns<T>(flags, renderer, defaults, warn): string[]

Defined in: packages/b2c-tooling-sdk/src/cli/columns.ts:149

Resolves which columns a list-style command should render. Mirrors the pattern duplicated across all *List commands:

  • If flags.columns === 'id,name' is provided, validate against the renderer's known keys; warn (and fall back to defaults) when no valid keys remain.
  • If flags.extended is set, return every column key (including those marked extended: true).
  • Otherwise, return the supplied default set.

Type Parameters

T

T

Row type (carried through the renderer).

Parameters

flags

ColumnFlags

The command's parsed --columns / --extended values. The parameter accepts the wider ColumnFlags shape, so callers can pass this.flags directly even when the inferred type contains additional fields.

renderer

TableRenderer<T>

The TableRenderer backing the table — used for key validation and to enumerate keys in extended mode.

defaults

string[]

Fallback set returned when neither flag overrides the selection.

warn

WarnFn = console.warn

Optional warn callback invoked when --columns is provided but no key validates; defaults to console.warn.

Returns

string[]

Ordered list of column keys to render.

Released under the Apache-2.0 License.