Aptivi - Manual
ProjectsWebsiteBlog
Terminaux - Manual
Terminaux - Manual
  • Welcome!
  • Breaking changes
    • API v1.0
    • API v2.0
    • API v3.0
    • API v4.0
    • API v5.0
    • API v6.0
    • API v7.0
  • Usage
    • Preface
    • Console Tools
      • Console Checker
        • Console Size Requirements
      • Image Rendering
        • Icons
      • Console Writers
        • Individual Writers
        • Cyclic Writers
          • Geometric Shapes
          • Charts
          • Text
          • Artistic
          • Progress Bars
          • Lists and Calendars
          • Miscellaneous
        • Informational Boxes
      • Textual UI
        • Interactive TUI
        • Console Screen
        • Console Resize Listener
        • VT Sequences
      • Console Wrapper
      • Console Colors
      • Color Templates
      • Presentation System
      • Console Extensions
      • Nerd Fonts
      • Terminal Info
      • Test Fixtures
      • Terminal Structures
      • Console Logging
    • Input Reader
      • Shells
        • Shell Structure
          • Help System
          • Command Parsing
          • Command Information
          • Command Switches
          • Shell Presets
          • Command Aliasing
      • Other Input
        • Keybindings
        • Choice-based inputs
        • Editors and Viewers
        • Figlet Font Selector
        • Color Wheel
        • Spinner Selector
      • Reader State
      • Reader Settings
      • Syntax Highlighting
      • Pointer Events
    • Color Sequences
      • Color Model Conversions
      • Color Model Parsing
      • Interop with System.Drawing.Color
  • Report an issue
  • Source code
  • API Reference
Powered by GitBook
On this page
Edit on GitHub
  1. Usage
  2. Input Reader
  3. Shells
  4. Shell Structure

Shell Presets

How do you want to display your prompt?

Last updated 5 months ago

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.

The first preset should implement a preset called Default in the ShellPresets dictionary.

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.

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

public class YourDefaultPreset : PromptPresetBase, IPromptPreset

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.

public override string PresetName { get; } = "Default";
  • PresetPrompt: Read-only property. Usually calls the overridable internal function PresetPromptBuilder(). If it's simple, overriding it with a string is enough.

public override string PresetPrompt =>
    PresetPromptBuilder();
internal override string PresetPromptBuilder()

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.

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

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

public override string PresetPromptCompletionShowcase =>
    PresetPromptCompletionBuilderShowcase();
internal override string PresetPromptCompletionBuilderShowcase()

Since the Showcase versions of the properties are meant to simulate how the preset would look in the real-world, you shouldn't try to access any external asset, especially those that the non-showcase properties use.

The easiest way to avoid using these assets is to make up things, such as database.sqlite for the SQL shell.