Hyprx.Core 0.0.0-alpha.4

This is a prerelease version of Hyprx.Core.
The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package Hyprx.Core --version 0.0.0-alpha.4
                    
NuGet\Install-Package Hyprx.Core -Version 0.0.0-alpha.4
                    
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="Hyprx.Core" Version="0.0.0-alpha.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Hyprx.Core" Version="0.0.0-alpha.4" />
                    
Directory.Packages.props
<PackageReference Include="Hyprx.Core" />
                    
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 Hyprx.Core --version 0.0.0-alpha.4
                    
#r "nuget: Hyprx.Core, 0.0.0-alpha.4"
                    
#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 Hyprx.Core@0.0.0-alpha.4
                    
#: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=Hyprx.Core&version=0.0.0-alpha.4&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Hyprx.Core&version=0.0.0-alpha.4&prerelease
                    
Install as a Cake Tool

Hyprx.Core

Overview

Hyprx Core extends the the .NET Base Class Library with key functionality such as:

  • Result type
  • Extension methods and members under the Extras namespaces for strings, spans, string builder, arrays, tasks, etc.
  • The static FileSystem class which provides an fs module similar to other std libraries including functions missing posix functions like copy, chown, chmod, stat, etc.
  • Enhanced logic for working with environments such as expanding bash style variables, appending/prepending paths to the environment path, etc

Usage

FileSystem examples

using static Hyprx.IO.FileSystem;

if (Environment.IsPrivilegedProcess)
{
    Chown("/home/user/file", "root", "root");
}

// copies recursively
CopyDir("/home/user/.local/bin", "/home/user/tmp/bin", true);

Result example

using Hyprx.Results;

using static Hyprx.Results.Result;

var strRes = Ok("10");

Console.WriteLine(strRes.IsOk);
Console.WriteLine(strRes.IsError);
Console.WriteLine(strRes.Value);
Console.WriteLine(strRes.Map(o => int.Parse(o)));

var bad = Fail<string>(new InvalidOperationException("Failed to get value"));

Console.WriteLine(strRes.IsOk);
Console.WriteLine(strRes.IsError);
Console.WriteLine(strRes.Error.Message);

var value = strRes.OrDefault("fallback string");
Console.WriteLine(value);

var res = TryCatch(() => {
    Hyprx.IO.FileSystem.Chown("/opt/app", "user", "user");
});

Console.WriteLine(strRes.IsOk);
Console.WriteLine(strRes.IsError);

Env Example

using Hyprx;

Console.WriteLine(Env.Expand("home is '${HOME}' on linux or '${USERPROFILE}' on windows."));

if (!Env.HasPath("C:\\Program Files\\Git\\usr\\bin"))
    Env.PrependPath("C:\\Program Files\\Git\\usr\\bin");

Env.Set(new Dictionary<string, string>{
    ["VALUE_ONE"] = "one",
    ["VALUE_TWO"] = "two"
});

Env.Vars["VALUE_THREE"] = "three"

Console.WriteLine(Env.Get("VALUE_ONE"));
Console.WriteLine(Env.Vars("VALUE_ONE"));

Console.WriteLine(Env.Vars.Home);
Console.WriteLine(Env.Vars.User);

Env.Unset("VALUE_TWO");

var result = Env.TryGet("VALUE_TWO");
var value = result.OrDefault("fallback value")l
Console.WriteLine(value);
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

# Hyprx.Core Changelog

## 0.0.0-alpha.0

Initial feature set:

- Result type
- Extension methods and members under the Extras namespaces for strings,
 spans, string builder, arrays, tasks, etc.
- The static FileSystem class which provides an fs module similar
 to other std libraries including functions missing posix functions
 like copy, chown, chmod, stat, etc.
- Enhanced logic for working with environments such as expanding
 bash style variables, appending/prepending paths to the environment
 path, etc.

## 0.0.0-alpha.1

- Add commonly used Generic types that inherit from Dictionary, List, and Dictionary.
 - `Map<TKey, TValue>`, `Map<TValue>`, and `Map` which is `Dictionary<string, object?>`
 - Add overloads for key,value tuples to enable `new Map([(key1, value1), (key2, value2)]);`
 - Add StringList which is a common list type along with a ContainsFold and IndexOfFolder methods.
 - Add OrderedMaps.