WriterUI 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package WriterUI --version 1.0.1
                    
NuGet\Install-Package WriterUI -Version 1.0.1
                    
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="WriterUI" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="WriterUI" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="WriterUI" />
                    
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 WriterUI --version 1.0.1
                    
#r "nuget: WriterUI, 1.0.1"
                    
#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 WriterUI@1.0.1
                    
#: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=WriterUI&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=WriterUI&version=1.0.1
                    
Install as a Cake Tool

WriterUI - Console UI Helper

Welcome to WriterUI, your go-to library for simplifying console-based user interactions and message formatting.

Description

WriterUI provides a set of convenient methods for interacting with the console, allowing you to display formatted messages, capture user input, and customize the console output to match your application's style.

Features

1. Formatted Messages

Easily display formatted messages on the console with customizable colors.

Writer.Message("Welcome to the writer console UI helper!");
Writer.Error("Oops! Something went wrong.");
Writer.Warn("Warning: Proceed with caution."); 

2. Input Capture

Capture user input from the console, ensuring seamless integration into your application flow.

int intInput = Writer.Input<int>("Please enter an integer:");
bool boolInput = Writer.Input<bool>("Enter 'true' or 'false':");
string strInput = Writer.Input("Enter a string:");

3. Customisation

Customise message colors and prompts to match your application's style.

Writer.Message("This message is in magenta color!", ConsoleColor.Magenta);
string customColorInput = Writer.Input("Enter a string:", ConsoleColor.DarkCyan);

4. Type Safety

Ensure type safety when capturing user input, preventing invalid inputs and runtime errors.

// No compilation for impossible tasks!
HttpClient badInput = Writer.Input<HttpClient>("Invalid input!");

Usage

Installation:

Add the WriterUI library to your project through NuGet Package Manager or by downloading and referencing the assembly.

Usage:

Import the WriterUI namespace into your code file. Use the provided methods (Message, Error, Warn, Input) to interact with the console.

using WriterUI;

Writer.Message("Welcome to my application!");
int age = Writer.Input<int>("Please enter your age:");

Customisation:

Experiment with different message colors and input prompts to enhance user experience.

Writer.Message("This is a custom message.", ConsoleColor.Green);
string userInput = Writer.Input("Enter a value:", ConsoleColor.Yellow);

Considerations

  • Error Handling: Writer will continue asking for input until a value can be converted when using Input<T>() but you might still need your own in some cases.
  • Input Validation: Always validate user input to prevent unexpected behavior or security vulnerabilities.
  • Thread Safety: Use synchronization mechanisms if accessing WriterUI methods concurrently from multiple threads.

Contributions

Contributions to the WriterUI library are welcome! If you encounter any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request on GitHub.

License

This library is licensed under the MIT License. See the LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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.
  • net6.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
2.0.0 128 2/22/2025
1.0.1 155 2/2/2024