Skip to content
View as Markdown
View as Markdown

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

Function: printFieldsBlock()

printFieldsBlock(title, fields, options): void

Defined in: packages/b2c-tooling-sdk/src/cli/details.ts:103

Renders a "details" block to stdout: a title, a separator, then a column of label: value rows. Optional named sections can be rendered after the primary block.

Parameters

title

string

Heading rendered above the fields.

fields

DetailField[]

Primary list of label / value rows. Rows whose value is undefined are skipped.

options

PrintFieldsBlockOptions = {}

Rendering options including optional sub-sections.

Returns

void

Example

typescript
printFieldsBlock('User Details', [
  ['Login', user.login],
  ['Email', user.email],
  ['Disabled', user.disabled?.toString()],
], {
  sections: user.roles?.length
    ? [{title: 'Roles', fields: user.roles.map((r) => [r, ''] as DetailField)}]
    : [],
});

Released under the Apache-2.0 License.