forked from amkovkov/GranuSightSoftware2
feat: starting to build a application itself
add "capture" and "camera-tuning" commands for cli
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
using System.CommandLine;
|
||||
|
||||
namespace GSS2.Commands;
|
||||
|
||||
public static class UI
|
||||
{
|
||||
public enum RenderingModes
|
||||
{
|
||||
X11,
|
||||
DRM
|
||||
}
|
||||
|
||||
public static readonly RootCommand RootCommand;
|
||||
public static readonly Command Command;
|
||||
public static readonly Option<bool> Fullscreen;
|
||||
public static readonly Option<RenderingModes> RenderingMode;
|
||||
public static readonly Option<bool> HideConsole;
|
||||
|
||||
static UI()
|
||||
{
|
||||
// Создаём команды, опции, аргументы и пр.
|
||||
RootCommand = new("Запустить графическое приложение");
|
||||
Command = new("ui")
|
||||
{
|
||||
Description = "Запустить графическое приложение"
|
||||
};
|
||||
Fullscreen = new("--fullscreen", ["-f"])
|
||||
{
|
||||
Description = "Запустить приложение в полноэкранном режиме",
|
||||
};
|
||||
RenderingMode = new("--mode", ["--rendering-mode", "-m"])
|
||||
{
|
||||
Description = "Режим рендеринга",
|
||||
|
||||
DefaultValueFactory = (_) => RenderingModes.X11
|
||||
};
|
||||
HideConsole = new("--hide-console", ["--no-console", "-c"])
|
||||
{
|
||||
Description = "Отключить вывод в консоль",
|
||||
DefaultValueFactory = (result) => result.GetValue(RenderingMode) == RenderingModes.DRM
|
||||
};
|
||||
|
||||
// Изменяем описания стандартных опций
|
||||
Helper.TranslateDefaultOptionDescriptions(RootCommand);
|
||||
|
||||
// Наполняем команды
|
||||
RootCommand.Add(Fullscreen);
|
||||
RootCommand.Add(RenderingMode);
|
||||
RootCommand.Add(HideConsole);
|
||||
RootCommand.SetAction(CommandAction);
|
||||
|
||||
Command.Add(Fullscreen);
|
||||
Command.Add(RenderingMode);
|
||||
Command.Add(HideConsole);
|
||||
Command.SetAction(CommandAction);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получить команду как корневую
|
||||
/// </summary>
|
||||
public static RootCommand GetCommand() => RootCommand;
|
||||
|
||||
/// <summary>
|
||||
/// Зарегистрировать команду как подкоманду
|
||||
/// </summary>
|
||||
/// <param name="command">Команда в которой необходимо зарегистрировать подкоманду</param>
|
||||
public static void RegisterCommand(Command command) => command.Add(Command);
|
||||
|
||||
private static void CommandAction(ParseResult result)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user