1
0

feat: Introduce explicit start, stop, and status commands, including minimum recording duration.

This commit is contained in:
2026-02-28 18:06:15 +01:00
parent 8ec0629e1a
commit a55e599c4f
13 changed files with 234 additions and 283 deletions

32
Commands/StartCommand.cs Normal file
View File

@@ -0,0 +1,32 @@
using System;
using System.Net.Sockets;
using System.Threading.Tasks;
using Spectre.Console;
using Toak.Core;
namespace Toak.Commands;
public static class StartCommand
{
public static async Task ExecuteAsync(bool verbose)
{
Logger.Verbose = verbose;
var socketPath = DaemonService.GetSocketPath();
try
{
using var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
var endPoint = new UnixDomainSocketEndPoint(socketPath);
await socket.ConnectAsync(endPoint);
await socket.SendAsync(new byte[] { 1 }, SocketFlags.None);
if (verbose) Console.WriteLine("Sent START command to daemon.");
}
catch (SocketException)
{
AnsiConsole.MarkupLine("[red]Failed to connect to Toak daemon.[/]");
}
catch (Exception ex)
{
AnsiConsole.MarkupLine($"[red]Error:[/] {ex.Message}");
}
}
}