Skip to content
View as Markdown
View as Markdown

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

Function: columnFlagsFor()

columnFlagsFor(columns, options): object

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

Returns the canonical --columns / --extended flag pair for a list-style command. The --columns flag advertises the available column keys (taken from the supplied columns map) so they show up in --help output.

Parameters

columns

Record<string, unknown>

Column definitions, used to enumerate available keys in the help text.

options

ColumnFlagsOptions = {}

Optional overrides for the short flag characters when they conflict with command-specific flags.

Returns

object

A flag definition object suitable for spreading into a command's static flags.

columns

columns: OptionFlag<string | undefined, CustomOptions>

extended

extended: BooleanFlag<boolean>

Example

typescript
static flags = {
  ...columnFlagsFor(COLUMNS),
  count: Flags.integer({char: 'n', description: '...'}),
};

// When -c is already used (e.g. for --category):
static flags = {
  category: Flags.string({char: 'c', description: '...'}),
  ...columnFlagsFor(COLUMNS, {columnsChar: false}),
};

Released under the Apache-2.0 License.