SolimusWrapper 1.0.2

dotnet add package SolimusWrapper --version 1.0.2
                    
NuGet\Install-Package SolimusWrapper -Version 1.0.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SolimusWrapper" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SolimusWrapper" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="SolimusWrapper" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SolimusWrapper --version 1.0.2
                    
#r "nuget: SolimusWrapper, 1.0.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SolimusWrapper@1.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SolimusWrapper&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=SolimusWrapper&version=1.0.2
                    
Install as a Cake Tool

SolimusWrapper

Лёгкая и оптимизированная библиотека для работы с CLI процессами в .NET.

NuGet Downloads License

✨ Особенности

  • 🚀 Fluent API — читаемый и удобный синтаксис
  • 🔒 Immutable — потокобезопасные команды
  • ⚡ Async/Await — полная асинхронность
  • 🔄 Pipes — перенаправление stdout, stderr, stdin
  • ⏱️ Таймауты — автоматическое завершение процессов
  • 🔁 Retry Logic — повторные попытки с exponential backoff
  • 🛡️ Shell Escaping — защита от инъекций команд
  • 📝 Structured Logging — логирование в консоль и файлы
  • 🌍 Кросс-платформенность — Windows, Linux, macOS
  • 📦 Zero Dependencies — никаких внешних зависимостей

🚀 Быстрый старт

using SolimusWrapper;

// Простой запуск
var result = await Command.Run("dotnet")
    .WithArguments("--version")
    .ExecuteAsync();

// Получить вывод
var output = await Command.Run("git")
    .WithArguments("status")
    .ExecuteAndReadOutputAsync();

📖 Основные возможности

Перенаправление потоков

await Command.Run("dotnet")
    .WithArguments("build")
    .WithStandardOutputPipe(PipeTarget.ToDelegate(Console.WriteLine))
    .WithStandardErrorPipe(PipeTarget.ToFile("errors.log"))
    .ExecuteAsync();

Таймауты и отмена

await Command.Run("long-process")
    .WithTimeout(TimeSpan.FromSeconds(30))
    .ExecuteAsync(cancellationToken);

🔁 Retry Logic

// Exponential backoff
var result = await Command.Run("curl")
    .WithArguments("https://api.example.com")
    .ExecuteWithRetryAsync(RetryOptions.Exponential(maxAttempts: 3));

// С настройками
await Command.Run("flaky-api")
    .ExecuteWithRetryAsync(options =>
    {
        options.MaxAttempts = 5;
        options.Delay = TimeSpan.FromSeconds(1);
        options.BackoffMultiplier = 2.0;
        options.OnRetry = attempt => Console.WriteLine($"Retry {attempt.AttemptNumber}...");
    });

🛡️ Shell Escaping

// Автоматическое экранирование опасных символов
var userInput = "file; rm -rf /";

await Command.Run("cat")
    .WithSafeArguments(userInput)
    .ExecuteAsync();

// Проверка на инъекции
if (ShellEscaper.LooksLikeInjection(userInput))
    Console.WriteLine("Опасный ввод!");

📝 Structured Logging

// Консольное логирование
await Command.Run("dotnet")
    .WithArguments("build")
    .WithConsoleLogging()
    .ExecuteAsync();

// Файловое логирование с маскированием паролей
using var logger = new FileCommandLogger("commands.log", new LoggingOptions 
{ 
    MaskSensitiveData = true 
});

await Command.Run("deploy")
    .WithArguments("--token", "secret123")
    .WithLogger(logger)
    .ExecuteAsync();

CommandBuilder

using SolimusWrapper.Builders;

await new CommandBuilder("dotnet")
    .AddArgument("publish")
    .AddFlag("-v", verbose)
    .AddArgumentIfNotEmpty("-c", configuration)
    .AddArgumentIf(OperatingSystem.IsLinux(), "-r", "linux-x64")
    .SetTimeout(TimeSpan.FromMinutes(10))
    .UseConsoleLogging()
    .ExecuteWithRetryAsync(RetryOptions.Default);

Кросс-платформенные хелперы

// Работает на Windows, Linux, macOS
var files = await CommandExtensions.ListFiles().ExecuteAndReadOutputAsync();
var pwd = await CommandExtensions.GetCurrentDirectory().ExecuteAndReadOutputAsync();

await CommandExtensions.Ping("google.com", 4)
    .WithStandardOutputPipe(PipeTarget.ToDelegate(Console.WriteLine))
    .ExecuteAsync();

📊 API

Класс Описание
Command Основной класс для выполнения команд
CommandBuilder Builder pattern для сложных команд
PipeTarget Цели вывода: StringBuilder, Delegate, Stream, File
PipeSource Источники ввода: String, Stream, File, Bytes
RetryOptions Настройки повторных попыток
ShellEscaper Экранирование аргументов
SafeCommand Безопасный запуск с валидацией
ICommandLogger Интерфейс логирования

🔧 Требования

  • .NET 10.0+

📄 Лицензия

MIT License

🔗 Ссылки

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2 160 1/1/2026
1.0.1 135 1/1/2026
1.0.0 134 12/30/2025