Wraith 0.3.0

dotnet add package Wraith --version 0.3.0
NuGet\Install-Package Wraith -Version 0.3.0
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="Wraith" Version="0.3.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Wraith --version 0.3.0
#r "nuget: Wraith, 0.3.0"
#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.
// Install Wraith as a Cake Addin
#addin nuget:?package=Wraith&version=0.3.0

// Install Wraith as a Cake Tool
#tool nuget:?package=Wraith&version=0.3.0

Wraith

Wraith is a library for building command-line applications. Wraith is heavily inspired by Spectre.Console but is designed around F#, with a focus on computation expressions to let you build simple, elegant inputs.

let nameStr = Format.underline "name"
let namePrompt() =
    Prompts.textPrompter {
        prompt $"Enter %s{nameStr}: "
        // on empty input, re-ask for the name
        loop_on_empty
        // display this message when the input is empty
        on_empty_message "Please enter a valid name"
        // clear display (so the prompt doesn't appear multiple times) on loop
        clear_on_loop
    }

namePrompt() // executes the  prompt and returns the user's input

See the examples folder for more examples on how to use Wraith.

Note: Wraith is very early in the development process and things might change a bit as the library grows. Please make issues to document your needs & feel free to contribute!

Resources:

https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences

Todo

  • Make paging options more configurable
  • Make paging display page #s and counts on header & footer
  • See if page up & page down can work (explore shift + arrow keys if not)
  • ~Steal~ Be heavily inspired by Spectre's fancy border tooling.
  • ~Steal~ Be heavily inspired by Spectre's live displays.
  • Multiple select lists.
  • Text alignment (left/justify/right).
  • More ansi styles support (even the ones that aren't often supported).
  • Full RGB color support.
  • Debate stealing Spectre's in-line markup syntax for styling & colors.
  • Figure out a better unit testing story. Or, really, just figure out any useful unit tests at all.
  • Tables/Grids
  • Charts
  • Rules (big horizontal bars with optional text)
  • Full canvas to let your inner artist free.

Builds

GitHub Actions
GitHub Actions
Build History

NuGet

Package Stable Prerelease
Wraith NuGet Badge NuGet Badge

Developing

Make sure the following requirements are installed on your system:

or


Environment Variables

  • CONFIGURATION will set the configuration of the dotnet commands. If not set, it will default to Release.
    • CONFIGURATION=Debug ./build.sh will result in -c additions to commands such as in dotnet build -c Debug
  • GITHUB_TOKEN will be used to upload release notes and Nuget packages to GitHub.
    • Be sure to set this before releasing
  • DISABLE_COVERAGE Will disable running code coverage metrics. AltCover can have severe performance degradation so it's worth disabling when looking to do a quicker feedback loop.
    • DISABLE_COVERAGE=1 ./build.sh

Building

> build.cmd <optional buildtarget> // on windows
$ ./build.sh  <optional buildtarget>// on unix

The bin of your library should look similar to:

$ tree src/MyCoolNewLib/bin/
src/MyCoolNewLib/bin/
└── Debug
    └── net50
        ├── MyCoolNewLib.deps.json
        ├── MyCoolNewLib.dll
        ├── MyCoolNewLib.pdb
        └── MyCoolNewLib.xml


Build Targets

  • Clean - Cleans artifact and temp directories.
  • DotnetRestore - Runs dotnet restore on the solution file.
  • DotnetBuild - Runs dotnet build on the solution file.
  • DotnetTest - Runs dotnet test on the solution file.
  • GenerateCoverageReport - Code coverage is run during DotnetTest and this generates a report via ReportGenerator.
  • WatchTests - Runs dotnet watch with the test projects. Useful for rapid feedback loops.
  • GenerateAssemblyInfo - Generates AssemblyInfo for libraries.
  • DotnetPack - Runs dotnet pack. This includes running Source Link.
  • SourceLinkTest - Runs a Source Link test tool to verify Source Links were properly generated.
  • PublishToNuGet - Publishes the NuGet packages generated in DotnetPack to NuGet via paket push.
  • GitRelease - Creates a commit message with the Release Notes and a git tag via the version in the Release Notes.
  • GitHubRelease - Publishes a GitHub Release with the Release Notes and any NuGet packages.
  • FormatCode - Runs Fantomas on the solution file.
  • BuildDocs - Generates Documentation from docsSrc and the XML Documentation Comments from your libraries in src.
  • WatchDocs - Generates documentation and starts a webserver locally. It will rebuild and hot reload if it detects any changes made to docsSrc files, libraries in src, or the docsTool itself.
  • ReleaseDocs - Will stage, commit, and push docs generated in the BuildDocs target.
  • Release - Task that runs all release type tasks such as PublishToNuGet, GitRelease, ReleaseDocs, and GitHubRelease. Make sure to read Releasing to setup your environment correctly for releases.

Releasing

git add .
git commit -m "Scaffold"
git remote add origin https://github.com/user/MyCoolNewLib.git
git push -u origin master
  • Create your NuGeT API key

    paket config add-token "https://www.nuget.org" 4003d786-cc37-4004-bfdf-c4f3e8ef9b3a
    
    • or set the environment variable NUGET_TOKEN to your key
  • Create a GitHub OAuth Token

    • You can then set the environment variable GITHUB_TOKEN to upload release notes and artifacts to github
    • Otherwise it will fallback to username/password
  • Then update the CHANGELOG.md with an "Unreleased" section containing release notes for this version, in KeepAChangelog format.

NOTE: Its highly recommend to add a link to the Pull Request next to the release note that it affects. The reason for this is when the RELEASE target is run, it will add these new notes into the body of git commit. GitHub will notice the links and will update the Pull Request with what commit referenced it saying "added a commit that referenced this pull request". Since the build script automates the commit message, it will say "Bump Version to x.y.z". The benefit of this is when users goto a Pull Request, it will be clear when and which version those code changes released. Also when reading the CHANGELOG, if someone is curious about how or why those changes were made, they can easily discover the work and discussions.

Here's an example of adding an "Unreleased" section to a CHANGELOG.md with a 0.1.0 section already released.

## [Unreleased]

### Added
- Does cool stuff!

### Fixed
- Fixes that silly oversight

## [0.1.0] - 2017-03-17
First release

### Added
- This release already has lots of features

[Unreleased]: https://github.com/user/MyCoolNewLib.git/compare/v0.1.0...HEAD
[0.1.0]: https://github.com/user/MyCoolNewLib.git/releases/tag/v0.1.0
  • You can then use the Release target, specifying the version number either in the RELEASE_VERSION environment variable, or else as a parameter after the target name. This will:
    • update CHANGELOG.md, moving changes from the Unreleased section into a new 0.2.0 section
      • if there were any prerelease versions of 0.2.0 in the changelog, it will also collect their changes into the final 0.2.0 entry
    • make a commit bumping the version: Bump version to 0.2.0 and adds the new changelog section to the commit's body
    • publish the package to NuGet
    • push a git tag
    • create a GitHub release for that git tag

macOS/Linux Parameter:

./build.sh Release 0.2.0

macOS/Linux Environment Variable:

RELEASE_VERSION=0.2.0 ./build.sh Release
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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
0.3.0 376 10/18/2022
0.2.0 391 7/7/2022
0.1.0 382 7/5/2022

## [0.3.0] - 2022-10-18

[0.3.0]: https://github.com/PaigeM89/Wraith/compare/v0.2.0...v0.3.0

### Changed
- Consolidated list prompt scrolling configs to a single shared set of options