gitlabEdit

brushShell Presets

How do you want to display your prompt?

Presets are the input style for a shell that can be customized to your liking by implementing a shell preset class.


Shell preset management

While ShellManager.GetLine() prompts for input, it decides which shell preset, PromptPresetBase, is used according to the list of presets, ShellPresets, that should make a new prompt preset class that you made for your shell.

CurrentPreset specifies the current PromptPresetBase class, which is usually found in the ShellPresets list. It usually calls the PromptPresetManager.CurrentPresets[ShellType] variable.

chevron-rightSetting a presethashtag

PromptPresetManager.SetPreset() queries both the shell pre-defined presets, ShellPresets, and the custom presets, CustomShellPresets. After that, it sets the preset to the specified preset in the internal CurrentPresets.

chevron-rightImplementing a presethashtag

Every preset must implement a base class, PromptPresetBase and IPromptPreset, as in below:

The only essential values that you must override in your shell preset class are:

  • PresetName: Read-only property. The shell preset name. If this preset is your first preset, it must be Default.

  • PresetPrompt: Read-only property. Usually calls the overridable internal function PresetPromptBuilder(). If it's simple, overriding it with a string is enough.

circle-exclamation
chevron-rightOptional overridable propertieshashtag

Optionally, these variables can be overridden:

  • PresetPromptCompletion: Read-only property. Usually calls the overridable internal function PresetPromptCompletionBuilder(). If it's simple, overriding it with a string is enough.

  • PresetPromptShowcase: Read-only property. Usually calls the overridable internal function PresetPromptBuilderShowcase(). If it's simple, overriding it with a string is enough.

  • PresetPromptCompletionShowcase: Read-only property. Usually calls the overridable internal function PresetPromptCompletionBuilderShowcase(). If it's simple, overriding it with a string is enough.

circle-exclamation

Last updated