feat: Implement new commands for recording control, configuration management, latency testing, and status display, updating program entry and project references.
This commit is contained in:
35
Commands/DiscardCommand.cs
Normal file
35
Commands/DiscardCommand.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Spectre.Console;
|
||||
using Toak.Audio;
|
||||
using Toak.Core;
|
||||
using Toak.IO;
|
||||
|
||||
namespace Toak.Commands;
|
||||
|
||||
public static class DiscardCommand
|
||||
{
|
||||
public static async Task ExecuteAsync(bool pipeToStdout, bool verbose)
|
||||
{
|
||||
Logger.Verbose = verbose;
|
||||
|
||||
if (StateTracker.IsRecording())
|
||||
{
|
||||
AudioRecorder.StopRecording();
|
||||
var wavPath = AudioRecorder.GetWavPath();
|
||||
if (File.Exists(wavPath)) File.Delete(wavPath);
|
||||
Notifications.Notify("Toak", "Recording discarded");
|
||||
if (!pipeToStdout)
|
||||
{
|
||||
AnsiConsole.MarkupLine("[yellow]Recording discarded.[/]");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!pipeToStdout)
|
||||
{
|
||||
AnsiConsole.MarkupLine("[grey]No active recording to discard.[/]");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user