Base class for building CLIs. By itself can be used for a CLI that does not support the tail command. Tail command uses Node repl class that is not implemented in other JS runtimes such as Bun. CliCoreBase should run in Bun.

Hierarchy (view full)

Constructors

Properties

currentDirectory: string
logLevel: keyof LogLevel
onInit: (() => void | Promise<void>)

Type declaration

    • (): void | Promise<void>
    • Returns void | Promise<void>

server: Server<typeof IncomingMessage, typeof ServerResponse>
templateProcessor: default

Methods

  • this method is just here as a stub to allow tests to pass. Color is in reality handled only by StatedRepl, it is not something that is possible to 'see' from the CLI since CLI returns pure JSON which has no concept of terminal colors.

    Returns void

  • Parameters

    • replCmdInputStr: string

    Returns Promise<any>

  • Parameters

    • args: string

    Returns {
        format: string;
        jsonPointer: string;
        jsonataExpression: undefined;
        number: number;
    } | {
        format: string;
        jsonPointer: string;
        jsonataExpression: string;
        number?: undefined;
    }

  • This Cli core command may be invoked directly from the REPL init command or from restore command

    • fromSnapshot=false, replCmdInoutStr example: -f "example/ex23.json" --tags=["PEACE"] --xf=example/myEnv.json
    • fromSnapshot=true, replCmdInoutStr example: -f "example/restoreSnapshot.json" --tags=["PEACE"] --xf=example/myEnv.json

    Parameters

    • replCmdInputStr: string
    • fromSnapshot: boolean = false

      when set to true, template processor will treat input as a snapshot of a previous templateProcessor state

    Returns Promise<any>

  • Parameters

    • replCmdInputStr: string

    Returns null | object

  • replCmdInoutStr example: -f "example/restoreSnapshot.json" --tags=["PEACE"] --xf=example/myEnv.json

    Parameters

    • replCmdInputStr: string

      the command line string that will be parsed into arguments

    Returns Promise<any>

  • Parameters

    • replCmdInputStr: string

    Returns ParsedArgs

  • Parameters

    • replCmdInputStr: string

    Returns {
        --?: string[];
        _: string[];
        ctx: any;
        filepath: any;
        oneshot: any;
        options: any;
        tags: any;
    }

    • Optional --?: string[]

      If opts['--'] is true, populated with everything after the --

    • _: string[]

      Contains all the arguments that didn't have an option associated with them

    • ctx: any
    • filepath: any
    • oneshot: any
    • options: any
    • tags: any
  • Parameters

    • filepath: string
    • Optional importPath: string

    Returns Promise<any>

  • Parameters

    • filepath: any
    • importPath: any

    Returns string

Generated using TypeDoc