cli-ux

  • Version 5.6.3
  • Published
  • 97.4 kB
  • 26 dependencies
  • MIT license

Install

npm i cli-ux
yarn add cli-ux
pnpm add cli-ux

Overview

cli IO utilities

Index

Variables

variable cli

const cli: {
config: Config;
warn: any;
error: any;
exit: any;
readonly prompt: typeof import('./prompt').prompt;
readonly anykey: typeof import('./prompt').anykey;
readonly confirm: typeof import('./prompt').confirm;
readonly action: ActionBase;
readonly prideAction: ActionBase;
styledObject(obj: any, keys?: string[] | undefined): void;
readonly styledHeader: typeof import('./styled/header').default;
readonly styledJSON: typeof import('./styled/json').default;
readonly table: typeof Table.table;
readonly tree: typeof import('./styled/tree').default;
readonly open: typeof import('./open').default;
readonly wait: (ms?: number) => Promise<unknown>;
readonly progress: typeof import('./styled/progress').default;
done(): Promise<void>;
trace(format: string, ...args: string[]): void;
debug(format: string, ...args: string[]): void;
info(format: string, ...args: string[]): void;
log(format?: string | undefined, ...args: string[]): void;
url(text: string, uri: string, params?: {}): void;
annotation(text: string, annotation: string): void;
flush(): Promise<void>;
};

    variable config

    const config: Config;

      variable ux

      const ux: {
      config: Config;
      warn: any;
      error: any;
      exit: any;
      readonly prompt: typeof import('./prompt').prompt;
      readonly anykey: typeof import('./prompt').anykey;
      readonly confirm: typeof import('./prompt').confirm;
      readonly action: ActionBase;
      readonly prideAction: ActionBase;
      styledObject(obj: any, keys?: string[] | undefined): void;
      readonly styledHeader: typeof import('./styled/header').default;
      readonly styledJSON: typeof import('./styled/json').default;
      readonly table: typeof Table.table;
      readonly tree: typeof import('./styled/tree').default;
      readonly open: typeof import('./open').default;
      readonly wait: (ms?: number) => Promise<unknown>;
      readonly progress: typeof import('./styled/progress').default;
      done(): Promise<void>;
      trace(format: string, ...args: string[]): void;
      debug(format: string, ...args: string[]): void;
      info(format: string, ...args: string[]): void;
      log(format?: string | undefined, ...args: string[]): void;
      url(text: string, uri: string, params?: {}): void;
      annotation(text: string, annotation: string): void;
      flush(): Promise<void>;
      };

        Classes

        class ActionBase

        class ActionBase {}

          property output

          output: string;

            property running

            readonly running: boolean;

              property status

              status: string;

                property std

                std: 'stdout' | 'stderr';

                  property stdmocks

                  protected stdmocks?: ['stdout' | 'stderr', string[]][];

                    property task

                    task: ITask;

                      property type

                      type: ActionType;

                        method pause

                        pause: (fn: () => any, icon?: string) => any;

                          method pauseAsync

                          pauseAsync: (fn: () => Promise<any>, icon?: string) => Promise<any>;

                            method start

                            start: (action: string, status?: string, opts?: Options) => void;

                              method stop

                              stop: (msg?: string) => void;

                                class Config

                                class Config {}

                                  property action

                                  action: ActionBase;

                                    property context

                                    context: any;

                                      property debug

                                      debug: boolean;

                                        property errorsHandled

                                        errorsHandled: boolean;

                                          property outputLevel

                                          outputLevel: Levels;

                                            property prideAction

                                            prideAction: ActionBase;

                                              property showStackTrace

                                              showStackTrace: boolean;

                                                class ExitError

                                                class ExitError extends Error {}

                                                  constructor

                                                  constructor(status: number, error?: Error);

                                                    property 'cli-ux'

                                                    'cli-ux': { exit: number };

                                                      property code

                                                      code: string;

                                                        property error

                                                        error?: Error;

                                                          Interfaces

                                                          interface IPromptOptions

                                                          interface IPromptOptions {}

                                                            property default

                                                            default?: string;

                                                              property prompt

                                                              prompt?: string;

                                                                property required

                                                                required?: boolean;
                                                                • Requires user input if true, otherwise allows empty input

                                                                property timeout

                                                                timeout?: number;

                                                                  property type

                                                                  type?: 'normal' | 'mask' | 'hide' | 'single';

                                                                    Namespaces

                                                                    namespace Table

                                                                    module 'lib/styled/table.d.ts' {}

                                                                      function table

                                                                      table: typeof table;

                                                                        namespace Table.table

                                                                        namespace Table.table {}

                                                                          variable Flags

                                                                          const Flags: {
                                                                          columns: any;
                                                                          sort: any;
                                                                          filter: any;
                                                                          csv: any;
                                                                          output: any;
                                                                          extended: any;
                                                                          'no-truncate': any;
                                                                          'no-header': any;
                                                                          };

                                                                            function flags

                                                                            flags: {
                                                                            (): IFlags;
                                                                            <
                                                                            Z extends
                                                                            | 'columns'
                                                                            | 'sort'
                                                                            | 'filter'
                                                                            | 'csv'
                                                                            | 'output'
                                                                            | 'extended'
                                                                            | 'no-truncate'
                                                                            | 'no-header' =
                                                                            | 'columns'
                                                                            | 'sort'
                                                                            | 'filter'
                                                                            | 'csv'
                                                                            | 'output'
                                                                            | 'extended'
                                                                            | 'no-truncate'
                                                                            | 'no-header'
                                                                            >(opts: {
                                                                            except: Z | Z[];
                                                                            }): ExcludeFlags<
                                                                            {
                                                                            columns: any;
                                                                            sort: any;
                                                                            filter: any;
                                                                            csv: any;
                                                                            output: any;
                                                                            extended: any;
                                                                            'no-truncate': any;
                                                                            'no-header': any;
                                                                            },
                                                                            Z
                                                                            >;
                                                                            <
                                                                            K extends
                                                                            | 'columns'
                                                                            | 'sort'
                                                                            | 'filter'
                                                                            | 'csv'
                                                                            | 'output'
                                                                            | 'extended'
                                                                            | 'no-truncate'
                                                                            | 'no-header' =
                                                                            | 'columns'
                                                                            | 'sort'
                                                                            | 'filter'
                                                                            | 'csv'
                                                                            | 'output'
                                                                            | 'extended'
                                                                            | 'no-truncate'
                                                                            | 'no-header'
                                                                            >(opts: {
                                                                            only: K | K[];
                                                                            }): IncludeFlags<
                                                                            {
                                                                            columns: any;
                                                                            sort: any;
                                                                            filter: any;
                                                                            csv: any;
                                                                            output: any;
                                                                            extended: any;
                                                                            'no-truncate': any;
                                                                            'no-header': any;
                                                                            },
                                                                            K
                                                                            >;
                                                                            };

                                                                              interface Column

                                                                              interface Column<T extends object> {}

                                                                                property extended

                                                                                extended: boolean;

                                                                                  property header

                                                                                  header: string;

                                                                                    property minWidth

                                                                                    minWidth: number;

                                                                                      method get

                                                                                      get: (row: T) => any;

                                                                                        interface Options

                                                                                        interface Options {}

                                                                                          property 'no-header'

                                                                                          'no-header'?: boolean;

                                                                                            property 'no-truncate'

                                                                                            'no-truncate'?: boolean;

                                                                                              property columns

                                                                                              columns?: string;

                                                                                                property extended

                                                                                                extended?: boolean;

                                                                                                  property filter

                                                                                                  filter?: string;

                                                                                                    property output

                                                                                                    output?: string;

                                                                                                      property sort

                                                                                                      sort?: string;

                                                                                                        method printLine

                                                                                                        printLine: (s: any) => any;

                                                                                                          index signature

                                                                                                          [key: string]: any;

                                                                                                            type Columns

                                                                                                            type Columns<T extends object> = {
                                                                                                            [key: string]: Partial<Column<T>>;
                                                                                                            };

                                                                                                              Package Files (6)

                                                                                                              Dependencies (26)

                                                                                                              Dev Dependencies (25)

                                                                                                              Peer Dependencies (0)

                                                                                                              No peer dependencies.

                                                                                                              Badge

                                                                                                              To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                              You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/cli-ux.

                                                                                                              • Markdown
                                                                                                                [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/cli-ux)
                                                                                                              • HTML
                                                                                                                <a href="https://www.jsdocs.io/package/cli-ux"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>