Skip to main content

Type Alias: CompleteIntegrationConfiguration

CompleteIntegrationConfiguration: Pick<AdditionalFlag, "brief" | "hidden"> & CompletionConfiguration & object

Options for customizing the behavior of the complete integration.

Type declaration

completeNextInput()?

readonly optional completeNextInput: (this, inputs) => Awaitable<boolean>

Stricli will always consider the final string in the inputs array to be a partial input for which completions should be proposed. In cases where the user has finished one input and is about to start another, shells may not add empty strings to the end of the input (argv) array. This function can be used to indicate that the final input should be treated as complete, and a new empty input should be added to the end of the array.

For example, the difference between the user typing cli root<TAB> and cli root <TAB> is whether to propose completions for root* or the next input after root. In both of these cases, the shell may invoke the application with the same argv array, and this function can use environment variables or other heuristics to distinguish between the two cases.

This function is in the critical path for generating completions, so it should be as fast as possible and avoid any unnecessary async operations.

Parameters

this: ApplicationContext

inputs: readonly string[]

Returns

Awaitable<boolean>

handleCompletions()

readonly handleCompletions: (this, completions) => Awaitable<void>

This function will be called with the proposed completions for the partial input. It is the responsibility of this function to handle the completions appropriately, in the context of whatever is invoking the application with the --complete flag. It should print the completions to stdout, or otherwise handle them in a way that the shell can present them to the user.

This function is in the critical path for generating completions, so it should be as fast as possible and avoid any unnecessary async operations.

Parameters

this: ApplicationContext

completions: readonly InputCompletion[]

Returns

Awaitable<void>

Defined in

packages/core/src/application/integrations/complete.ts:13