WriterUI 2.0.0
dotnet add package WriterUI --version 2.0.0
NuGet\Install-Package WriterUI -Version 2.0.0
<PackageReference Include="WriterUI" Version="2.0.0" />
<PackageVersion Include="WriterUI" Version="2.0.0" />
<PackageReference Include="WriterUI" />
paket add WriterUI --version 2.0.0
#r "nuget: WriterUI, 2.0.0"
#:package WriterUI@2.0.0
#addin nuget:?package=WriterUI&version=2.0.0
#tool nuget:?package=WriterUI&version=2.0.0
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 functional methods for interacting with the console, allowing you to display formatted messages, capture user input, and customize the console output. Written in F# to leverage functional programming patterns and pipeline operations.
Features
1. Formatted Messages
Display formatted messages with optional colors and spacing.
message None "Welcome to the writer console UI helper!"
error "Oops! Something went wrong."
warn "Warning: Proceed with caution."
2. Input Capture
Type-safe input capture with built-in error handling.
let intInput = inputTyped<int> None (Some "Please enter an integer:")
let boolInput = inputTyped<bool> None (Some "Enter 'true' or 'false':")
let strInput = input None (Some "Enter a string:")
3. Customisation
Customise colors and formatting using the WriteOptions record:
message (Some {
CustomColor = Some ConsoleColor.Magenta
BackgroundColor = Some ConsoleColor.Black
IncludeLineSpace = true
}) "Customized message!"
let customInput = input
(Some {
CustomColor = Some ConsoleColor.DarkCyan
BackgroundColor = None
IncludeLineSpace = true
})
(Some "Enter with style:")
Usage
Installation
Add the WriterUI library through NuGet Package Manager.
Basic Usage
open WriterUI
message None "Welcome to my application!"
let age = inputTyped<int> None (Some "Please enter your age:")
Why F#?
The library has been rewritten in F# to:
- Better support functional programming patterns
- Enable pipeline operations with consistent parameter ordering
- Provide cleaner option handling
- Leverage F#'s type inference and pattern matching
- Simplify error handling
Type Safety
The library provides type-safe input handling using F#'s generic constraints:
let age = inputTyped<int> None (Some "Enter age:") // Works
let request = inputTyped<HttpClient> None (Some "Stringify an HttpClient?") // No way!
let name = input None (Some "Enter name:") // String input
Considerations
- Error handling is built into inputTyped<'T> with recursive retry
- All functions handle None cases gracefully
- Background colors automatically reset to terminal defaults
- Thread-safe console operations
License
MIT License. See the LICENSE file for details.
v2.0.0 Key changes:
- Updated syntax to show F# examples
- Removed C# examples and namespace references
- Added explanation for F# migration
- Simplified API examples
- Updated configuration examples to use F# record syntax
- Added note about background color handling
| Product | Versions 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. |
-
net6.0
- FSharp.Core (>= 9.0.101)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.