Type Alias RelevantArgsInput

RelevantArgsInput: {
    binName: string | undefined;
    errorIfNotFound?: boolean;
    fileName: string;
    rawArgs: ReadonlyArray<string>;
}

Input for extractRelevantArgs.

Type declaration

  • binName: string | undefined

    Executable bin name for your script. This should be the "bin" name in your package.json, or simply your package name if you have no custom bin name defined.

    See https://docs.npmjs.com/cli/v10/configuring-npm/package-json#bin for details on the bin field of package.json

  • OptionalerrorIfNotFound?: boolean

    If set to true, this function with throw an error if the given file or bin name was not found in the given arguments list.

  • fileName: string

    The name or path of your script file that will be executed via the CLI. This should almost always simply be __filename in CJS or import.meta.filename in ESM.

  • rawArgs: ReadonlyArray<string>

    Raw arguments passed to the CLI. Typically this will simply be process.argv.