From df73248412da3ffacff6e45558599513572a4882 Mon Sep 17 00:00:00 2001 From: Aptivi CEO Date: Sat, 10 Feb 2024 09:45:33 +0300 Subject: [PATCH] ref - Refactored the base prompt preset --- Type: ref Breaking: False Doc Required: False Part: 1/1 --- .../Shell/Prompts/PromptPresetBase.cs | 41 +++++++++++-------- .../Shell/Shells/UESH/Presets/Default.cs | 8 ---- 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/public/Nitrocid/Shell/Prompts/PromptPresetBase.cs b/public/Nitrocid/Shell/Prompts/PromptPresetBase.cs index 9c4de684c9..c6c1494492 100644 --- a/public/Nitrocid/Shell/Prompts/PromptPresetBase.cs +++ b/public/Nitrocid/Shell/Prompts/PromptPresetBase.cs @@ -18,7 +18,6 @@ // using Nitrocid.Kernel.Debugging; -using Nitrocid.Kernel.Exceptions; namespace Nitrocid.Shell.Prompts { @@ -32,51 +31,59 @@ public class PromptPresetBase : IPromptPreset public virtual string PresetName { get; } = "BasePreset"; /// - public virtual string PresetPrompt { get; } = "> "; + public virtual string PresetPrompt => + PresetPromptBuilder(); /// - public virtual string PresetPromptCompletion { get; } = "[+] > "; + public virtual string PresetPromptCompletion => + PresetPromptCompletionBuilder(); /// - public virtual string PresetPromptShowcase { get; } = "> "; + public virtual string PresetPromptShowcase => + PresetPromptBuilderShowcase(); /// - public virtual string PresetPromptCompletionShowcase { get; } = "[+] > "; + public virtual string PresetPromptCompletionShowcase => + PresetPromptCompletionBuilderShowcase(); /// public virtual string PresetShellType { get; } = "Shell"; internal virtual string PresetPromptBuilder() { - DebugWriter.WriteDebug(DebugLevel.E, "Tried to call prompt builder on base."); - throw new KernelException(KernelExceptionType.NotImplementedYet); + DebugWriter.WriteDebug(DebugLevel.W, "Tried to call prompt builder on base."); + return "> "; } - string IPromptPreset.PresetPromptBuilder() => PresetPromptBuilder(); + string IPromptPreset.PresetPromptBuilder() => + PresetPromptBuilder(); internal virtual string PresetPromptCompletionBuilder() { - DebugWriter.WriteDebug(DebugLevel.E, "Tried to call prompt builder on base."); - throw new KernelException(KernelExceptionType.NotImplementedYet); + DebugWriter.WriteDebug(DebugLevel.W, "Tried to call prompt builder on base."); + return "[+] > "; } - string IPromptPreset.PresetPromptCompletionBuilder() => PresetPromptCompletionBuilder(); + string IPromptPreset.PresetPromptCompletionBuilder() => + PresetPromptCompletionBuilder(); internal virtual string PresetPromptBuilderShowcase() { - DebugWriter.WriteDebug(DebugLevel.E, "Tried to call prompt builder on base."); - throw new KernelException(KernelExceptionType.NotImplementedYet); + DebugWriter.WriteDebug(DebugLevel.W, "Tried to call prompt builder on base."); + return "> "; } - string IPromptPreset.PresetPromptBuilderShowcase() => PresetPromptBuilderShowcase(); + string IPromptPreset.PresetPromptBuilderShowcase() => + PresetPromptBuilderShowcase(); internal virtual string PresetPromptCompletionBuilderShowcase() { - DebugWriter.WriteDebug(DebugLevel.E, "Tried to call prompt builder on base."); - throw new KernelException(KernelExceptionType.NotImplementedYet); + DebugWriter.WriteDebug(DebugLevel.W, "Tried to call prompt builder on base."); + return "[+] > "; } - string IPromptPreset.PresetPromptCompletionBuilderShowcase() => PresetPromptCompletionBuilderShowcase(); + string IPromptPreset.PresetPromptCompletionBuilderShowcase() => + PresetPromptCompletionBuilderShowcase(); } } diff --git a/public/Nitrocid/Shell/Shells/UESH/Presets/Default.cs b/public/Nitrocid/Shell/Shells/UESH/Presets/Default.cs index ebcb4c45f0..38908865fe 100644 --- a/public/Nitrocid/Shell/Shells/UESH/Presets/Default.cs +++ b/public/Nitrocid/Shell/Shells/UESH/Presets/Default.cs @@ -40,14 +40,6 @@ public class DefaultPreset : PromptPresetBase, IPromptPreset /// public override string PresetName { get; } = "Default"; - /// - public override string PresetPrompt => - PresetPromptBuilder(); - - /// - public override string PresetPromptShowcase => - PresetPromptBuilderShowcase(); - internal override string PresetPromptBuilder() { var PresetStringBuilder = new StringBuilder();