mirror of
https://github.com/Stone-Red-Code/RemSox.git
synced 2026-09-04 00:56:19 +02:00
Code cleanup
This commit is contained in:
@@ -60,7 +60,7 @@ public static class CommandManager
|
||||
arguments = trimmedInput[commandName.Length..].TrimStart();
|
||||
}
|
||||
|
||||
cancellationToken.Register(async () => await entry.Value.StopAsync());
|
||||
CancellationTokenRegistration unused = cancellationToken.Register(async () => await entry.Value.StopAsync());
|
||||
|
||||
await entry.Value.ExecuteAsync(arguments, printLine);
|
||||
return true;
|
||||
|
||||
@@ -1,29 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using RemSox.Processing;
|
||||
|
||||
namespace RemSox.UI.CLI.Commands
|
||||
namespace RemSox.UI.CLI.Commands;
|
||||
|
||||
public class YesNtCommand : ICommand
|
||||
{
|
||||
public class YesNtCommand : ICommand
|
||||
public string Name => "yesnt";
|
||||
|
||||
public string Description => "Start the YesNt interpreter";
|
||||
|
||||
private int processId;
|
||||
|
||||
public async Task ExecuteAsync(string? arguments, Action<string> printLine)
|
||||
{
|
||||
public string Name => "yesnt";
|
||||
processId = ProcessManager.SpawnProcess<Processes.YesNtInterpreterProcess>(arguments?.Split(',') ?? []);
|
||||
await ProcessManager.WaitForProcessExitAsync(processId);
|
||||
}
|
||||
|
||||
public string Description => "Start the YesNt interpreter";
|
||||
|
||||
private int processId;
|
||||
|
||||
public async Task ExecuteAsync(string? arguments, Action<string> printLine)
|
||||
{
|
||||
processId = ProcessManager.SpawnProcess<Processes.YesNtInterpreterProcess>(arguments?.Split(',') ?? []);
|
||||
await ProcessManager.WaitForProcessExitAsync(processId);
|
||||
}
|
||||
|
||||
public Task StopAsync()
|
||||
{
|
||||
ProcessManager.StopProcess(processId);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
public Task StopAsync()
|
||||
{
|
||||
ProcessManager.StopProcess(processId);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
+4
-1
@@ -24,5 +24,8 @@ public interface ICommand
|
||||
/// <summary>
|
||||
/// Interrupts the command if it's currently running. This is called when the user presses Ctrl+C in the CLI.
|
||||
/// </summary>
|
||||
Task StopAsync() => Task.CompletedTask;
|
||||
Task StopAsync()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user