From e3b1ce802961027b401274b56be2a1c577a56ff8 Mon Sep 17 00:00:00 2001 From: Anupal Mishra Date: Tue, 3 Feb 2026 21:13:33 +0000 Subject: [PATCH] Remove Dummy command and service --- stmx/Commands/DummyCommand.cs | 34 ---------------------------- stmx/Program.cs | 2 -- stmx/Services/DummyService.cs | 14 ------------ stmx/Services/DummyServiceOptions.cs | 6 ----- 4 files changed, 56 deletions(-) delete mode 100644 stmx/Commands/DummyCommand.cs delete mode 100644 stmx/Services/DummyService.cs delete mode 100644 stmx/Services/DummyServiceOptions.cs diff --git a/stmx/Commands/DummyCommand.cs b/stmx/Commands/DummyCommand.cs deleted file mode 100644 index 0c25c0d..0000000 --- a/stmx/Commands/DummyCommand.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System.CommandLine; -using System.CommandLine.Invocation; - -using stmx.Services; - -namespace stmx.Commands; - -class DummyCommand : Command -{ - private readonly DummyService _dummy; - - public DummyCommand(DummyService dummy) : base("dummy", "echoes back value") - { - _dummy = dummy ?? throw new ArgumentNullException(nameof(dummy)); - - var dataInputOption = new Option("--input", ["-i"]); - dataInputOption.Description = "value to echo back"; - dataInputOption.DefaultValueFactory = _ => _dummy.Options.DefaultDataInput; - - Add(dataInputOption); - - SetAction(async (parseResult, cancellationToken) => - { - var dataInputOptionValue = parseResult.GetValue(dataInputOption); - await Execute(dataInputOptionValue!); - }); - } - - private async Task Execute(string dataInput) - { - var retValue = await _dummy.GetDummyData(dataInput); - Console.WriteLine(retValue); - } -} diff --git a/stmx/Program.cs b/stmx/Program.cs index 94d1b04..ea8ea52 100644 --- a/stmx/Program.cs +++ b/stmx/Program.cs @@ -12,11 +12,9 @@ class Program static async Task Main(string[] args) { var services = new ServiceCollection(); - services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); - services.AddTransient(); // TODO: introduce a switch to load based on OS services.AddTransient(); diff --git a/stmx/Services/DummyService.cs b/stmx/Services/DummyService.cs deleted file mode 100644 index 585fbf7..0000000 --- a/stmx/Services/DummyService.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace stmx.Services; - -class DummyService() -{ - public DummyServiceOptions Options { get; } = new DummyServiceOptions(); - - public Task GetDummyData(string? dataInput = null) - { - if (dataInput == null) dataInput = Options.DefaultDataInput; - var retValue = $"dummy data return: {dataInput}"; - - return Task.FromResult(retValue); - } -} diff --git a/stmx/Services/DummyServiceOptions.cs b/stmx/Services/DummyServiceOptions.cs deleted file mode 100644 index 7e06877..0000000 --- a/stmx/Services/DummyServiceOptions.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace stmx.Services; - -class DummyServiceOptions -{ - public string DefaultDataInput { get; set; } = "default input"; -}