From 5d23ae26b855d5aa03dafec24327deeae696660c Mon Sep 17 00:00:00 2001 From: Govorunb Date: Mon, 15 Jul 2024 05:54:33 +1000 Subject: [PATCH] forgor suppression --- SCHIZO/Commands/Output/CommandOutputStack.cs | 1 + SCHIZO/Commands/Output/SuppressOutputSink.cs | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 SCHIZO/Commands/Output/SuppressOutputSink.cs diff --git a/SCHIZO/Commands/Output/CommandOutputStack.cs b/SCHIZO/Commands/Output/CommandOutputStack.cs index 01fcbff0..7e703a29 100644 --- a/SCHIZO/Commands/Output/CommandOutputStack.cs +++ b/SCHIZO/Commands/Output/CommandOutputStack.cs @@ -57,6 +57,7 @@ public void ModifyForConsoleNautilus(CommandExecutionContext ctx) { Sinks.Clear(); Sinks.Push(new SetResultSink(ctx)); + Sinks.Push(new SuppressOutputSink()); } /// diff --git a/SCHIZO/Commands/Output/SuppressOutputSink.cs b/SCHIZO/Commands/Output/SuppressOutputSink.cs new file mode 100644 index 00000000..2d7ffc4f --- /dev/null +++ b/SCHIZO/Commands/Output/SuppressOutputSink.cs @@ -0,0 +1,14 @@ +using SCHIZO.Helpers; + +namespace SCHIZO.Commands.Output; + +public sealed class SuppressOutputSink : ISink +{ + public bool TryConsume(ref object output) + { + if (MessageHelpers.SuppressOutput) + output = null; + + return false; + } +}