Skip to main content

Interface: ApplicationText

The full set of static text and text-returning callbacks that are necessary for Stricli to write the necessary output.

Extends​

Properties​

briefs​

readonly briefs: DocumentationBriefs

Short documentation brief strings used to build help text.

Inherited from​

DocumentationText.briefs

Defined in​

packages/core/src/text.ts:109


commandErrorResult()​

readonly commandErrorResult: (this, err, ansiColor) => string

Formatted error message for the case where an Error was safely returned from the command. Users are most likely to hit this case, so make sure that the error text provides practical, usable feedback.

If ansiColor is true, this string can use ANSI terminal codes. Codes may have already been applied so be aware you may have to reset to achieve the desired output.

Parameters​

• this: ExceptionFormatting

• err: Error

• ansiColor: boolean

Returns​

string

Inherited from​

ApplicationErrorFormatting.commandErrorResult

Defined in​

packages/core/src/text.ts:179


currentVersionIsNotLatest()​

readonly currentVersionIsNotLatest: (args) => string

Generate warning text to be written to stdout when the latest version is not installed. Should include brief instructions for how to update to that version.

If ansiColor is true, this string can use ANSI terminal codes. Codes may have already been applied so be aware you may have to reset to achieve the desired output.

Parameters​

• args

• args.ansiColor: boolean

• args.currentVersion: string

• args.latestVersion: string

• args.upgradeCommand?: string

Returns​

string

Defined in​

packages/core/src/text.ts:253


exceptionWhileLoadingCommandContext()​

readonly exceptionWhileLoadingCommandContext: (this, exc, ansiColor) => string

Formatted error message for the case where some exception was thrown while loading the context for the command run. This likely indicates an issue with the application itself or possibly the user's installation of the application.

If ansiColor is true, this string can use ANSI terminal codes. Codes may have already been applied so be aware you may have to reset to achieve the desired output.

Parameters​

• this: ExceptionFormatting

• exc: unknown

• ansiColor: boolean

Returns​

string

Inherited from​

ApplicationErrorFormatting.exceptionWhileLoadingCommandContext

Defined in​

packages/core/src/text.ts:159


exceptionWhileLoadingCommandFunction()​

readonly exceptionWhileLoadingCommandFunction: (this, exc, ansiColor) => string

Formatted error message for the case where some exception was thrown while loading the command function. This likely indicates an issue with the application itself or possibly the user's installation of the application.

If ansiColor is true, this string can use ANSI terminal codes. Codes may have already been applied so be aware you may have to reset to achieve the desired output.

Parameters​

• this: ExceptionFormatting

• exc: unknown

• ansiColor: boolean

Returns​

string

Inherited from​

ApplicationErrorFormatting.exceptionWhileLoadingCommandFunction

Defined in​

packages/core/src/text.ts:147


exceptionWhileParsingArguments()​

readonly exceptionWhileParsingArguments: (this, exc, ansiColor) => string

Formatted error message for the case where some exception was thrown while parsing the arguments.

Exceptions intentionally thrown by this library while parsing arguments will extend from ArgumentScannerError. These subclasses provide additional context about the specific error. Use the formatMessageForArgumentScannerError helper to handle the different error types.

If ansiColor is true, this string can use ANSI terminal codes. Codes may have already been applied so be aware you may have to reset to achieve the desired output.

Parameters​

• this: ExceptionFormatting

• exc: unknown

• ansiColor: boolean

Returns​

string

Inherited from​

ApplicationErrorFormatting.exceptionWhileParsingArguments

Defined in​

packages/core/src/text.ts:139


exceptionWhileRunningCommand()​

readonly exceptionWhileRunningCommand: (this, exc, ansiColor) => string

Formatted error message for the case where some exception was thrown while running the command. Users are most likely to hit this case, so make sure that the error text provides practical, usable feedback.

If ansiColor is true, this string can use ANSI terminal codes. Codes may have already been applied so be aware you may have to reset to achieve the desired output.

Parameters​

• this: ExceptionFormatting

• exc: unknown

• ansiColor: boolean

Returns​

string

Inherited from​

ApplicationErrorFormatting.exceptionWhileRunningCommand

Defined in​

packages/core/src/text.ts:171


exceptionWhileRunningIntegrationFlag()​

readonly exceptionWhileRunningIntegrationFlag: (this, args) => string

Formatted error message for the case where some exception was thrown while running an integration flag.

If ansiColor is true, this string can use ANSI terminal codes. Codes may have already been applied so be aware you may have to reset to achieve the desired output.

Parameters​

• this: ExceptionFormatting

• args

• args.ansiColor: boolean

• args.exception: unknown

• args.integration: string

Returns​

string

Inherited from​

ApplicationErrorFormatting.exceptionWhileRunningIntegrationFlag

Defined in​

packages/core/src/text.ts:232


exceptionWhileRunningIntegrationHook()​

readonly exceptionWhileRunningIntegrationHook: (this, args) => string

Formatted error message for the case where some exception was thrown while running the command. Users are most likely to hit this case, so make sure that the error text provides practical, usable feedback.

If ansiColor is true, this string can use ANSI terminal codes. Codes may have already been applied so be aware you may have to reset to achieve the desired output.

Parameters​

• this: ExceptionFormatting

• args

• args.ansiColor: boolean

• args.exception: unknown

• args.hook: string

• args.integration: string

Returns​

string

Inherited from​

ApplicationErrorFormatting.exceptionWhileRunningIntegrationHook

Defined in​

packages/core/src/text.ts:217


formatException()?​

readonly optional formatException: (exc) => string

Formatted message to display this thrown exception in the terminal. The default behavior returns the stack property if the object extends from Error, and otherwise calls String().

This method should never throw and should not include any ANSI terminal codes in the resulting string.

Parameters​

• exc: unknown

Returns​

string

Inherited from​

ApplicationErrorFormatting.formatException

Defined in​

packages/core/src/text.ts:122


headers​

readonly headers: DocumentationHeaders

Section header strings used to build help text.

Inherited from​

DocumentationText.headers

Defined in​

packages/core/src/text.ts:105


keywords​

readonly keywords: DocumentationKeywords

Keyword strings used to build help text.

Inherited from​

DocumentationText.keywords

Defined in​

packages/core/src/text.ts:101


noCommandRegisteredForInput()​

readonly noCommandRegisteredForInput: (args) => string

Formatted error message for the case where the supplied command line inputs do not resolve to a registered command. Supplied with arguments for the argument in question, and several possible corrections based on registered commands.

If ansiColor is true, this string can use ANSI terminal codes. Codes may have already been applied so be aware you may have to reset to achieve the desired output.

Parameters​

• args

• args.ansiColor: boolean

• args.corrections: readonly string[]

• args.input: string

Returns​

string

Inherited from​

ApplicationErrorFormatting.noCommandRegisteredForInput

Defined in​

packages/core/src/text.ts:193


noTextAvailableForLocale()​

readonly noTextAvailableForLocale: (args) => string

Formatted error message for the case where the application does not provide text for the current requested locale. Should indicate that the default locale will be used instead.

If ansiColor is true, this string can use ANSI terminal codes. Codes may have already been applied so be aware you may have to reset to achieve the desired output.

Parameters​

• args

• args.ansiColor: boolean

• args.defaultLocale: string

• args.requestedLocale: string

Returns​

string

Inherited from​

ApplicationErrorFormatting.noTextAvailableForLocale

Defined in​

packages/core/src/text.ts:205