@salesforce/sf-plugins-core
    Preparing search index...

    Class Ux

    UX methods for plugins. Automatically suppress console output if outputEnabled is set to false.

    import { SfCommand, Ux } from '@salesforce/sf-plugins-core';
    import { AnyJson } from '@salesforce/ts-types';

    class MyCommand extends SfCommand<AnyJson> {
    public async run(): Promise<AnyJson> {
    const ux = new Ux(!this.jsonEnabled());
    }
    }

    Hierarchy (View Summary)

    Index
    • Parameters

      • __namedParameters: { jsonEnabled: boolean } = ...

      Returns Ux

    outputEnabled: boolean
    spinner: Spinner
    • Log a message to the console. This will be automatically suppressed if output is disabled.

      Parameters

      • Optionalmessage: string

        Message to log. Formatting is supported.

      • ...args: string[]

        Args to be used for formatting.

      Returns void

    • Log a message to stderr. This will be automatically suppressed if output is disabled.

      Parameters

      • Optionalmessage: string

        Message to log. Formatting is supported.

      • ...args: string[]

        Args to be used for formatting.

      Returns void

    • Return a string rendering of a table.

      Type Parameters

      • T extends Record<string, unknown>

      Parameters

      • options: TableOptions<T>

        Table properties

      Returns string

      string rendering of a table

    • Display stylized header to the console. This will be automatically suppressed if output is disabled.

      Parameters

      • text: string

        header to display

      Returns void

    • Display stylized JSON to the console. This will be automatically suppressed if output is disabled.

      Parameters

      • obj: AnyJson

        JSON to display

      • Optionaltheme: Record<string, string>

      Returns void

    • Display stylized object to the console. This will be automatically suppressed if output is disabled.

      Parameters

      • obj: AnyJson

        Object to display

      • Optionalkeys: string[]

        Keys of object to display

      Returns void

    • Display a table to the console. This will be automatically suppressed if output is disabled.

      Type Parameters

      • T extends Record<string, unknown>

      Parameters

      • options: TableOptions<T>

        Table properties

      Returns void

    • Display a url to the console. This will be automatically suppressed if output is disabled.

      Parameters

      • text: string

        text to display

      • uri: string

        URL link

      • params: {} = {}

      Returns void

    • Log a warning message to the console. This will be automatically suppressed if output is disabled.

      Parameters

      • message: string | Error

        Warning message to log.

      Returns void