ReadLine alternatives and similar packages
Based on the "CLI" category.
Alternatively, view ReadLine alternatives based on common mentions on social networks and blogs.
-
spectre.console
A .NET library that makes it easier to create beautiful console applications. -
Command Line Parser
The best C# command line parser that brings standardized *nix getopt style, for .NET. Includes F# support -
Sieve
⚗️ Clean & extensible Sorting, Filtering, and Pagination for ASP.NET Core -
Console Framework
Cross-platform toolkit for easy development of TUI applications. -
Fluent Command Line Parser
A simple, strongly typed .NET C# command line parser library using a fluent easy to use interface -
Power Args
The ultimate .NET Standard command line argument parser -
CsConsoleFormat
.NET C# library for advanced formatting of console output [Apache] -
EntryPoint
Composable CLI Argument Parser for all modern .Net platforms. -
NFlags
Simple yet powerfull library to made parsing CLI arguments easy. Library also allow to print usage help "out of box". -
Appccelerate - Command Line Parser
A simple command line parser with fluent definition API. -
RunInfoBuilder
A unique command line parser for .NET that utilizes object trees for commands. -
Sitemap Tools
A sitemap (sitemap.xml) querying and parsing library for .NET -
Robots Exclusion Tools
A "robots.txt" parsing and querying library for .NET -
DarkXaHTeP.CommandLine
Allows creating CommandLine applications using Microsoft.Extensions.CommandLineUtils together with DI, Configuration and Logging in a convenient way similar to AspNetCore Hosting -
Tamar.ANSITerm
“ANSITerm” provides ANSI escape codes and true color formatting for .NET Core's Console on Linux terminals.
ONLYOFFICE Docs — document collaboration in your environment
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of ReadLine or a related project?
README
ReadLine
ReadLine is a GNU Readline like library built in pure C#. It can serve as a drop in replacement for the inbuilt Console.ReadLine()
and brings along
with it some of the terminal goodness you get from unix shells, like command history navigation and tab auto completion.
It is cross platform and runs anywhere .NET is supported, targeting netstandard1.3
means that it can be used with .NET Core as well as the full .NET Framework.
Shortcut Guide
Shortcut | Comment |
---|---|
Ctrl +A / HOME |
Beginning of line |
Ctrl +B / ← |
Backward one character |
Ctrl +C |
Send EOF |
Ctrl +E / END |
End of line |
Ctrl +F / → |
Forward one character |
Ctrl +H / Backspace |
Delete previous character |
Tab |
Command line completion |
Shift +Tab |
Backwards command line completion |
Ctrl +J / Enter |
Line feed |
Ctrl +K |
Cut text to the end of line |
Ctrl +L / Esc |
Clear line |
Ctrl +M |
Same as Enter key |
Ctrl +N / ↓ |
Forward in history |
Ctrl +P / ↑ |
Backward in history |
Ctrl +U |
Cut text to the start of line |
Ctrl +W |
Cut previous word |
Backspace |
Delete previous character |
Ctrl + D / Delete |
Delete succeeding character |
Installation
Available on NuGet
Visual Studio:
PM> Install-Package ReadLine
.NET Core CLI:
dotnet add package ReadLine
Usage
Read input from the console
string input = ReadLine.Read("(prompt)> ");
Read password from the console
string password = ReadLine.ReadPassword("(prompt)> ");
Note: The (prompt>)
is optional
History management
// Get command history
ReadLine.GetHistory();
// Add command to history
ReadLine.AddHistory("dotnet run");
// Clear history
ReadLine.ClearHistory();
// Disable history
ReadLine.HistoryEnabled = false;
Note: History information is persisted for an entire application session. Also, calls to ReadLine.Read()
automatically adds the console input to history
Auto-Completion
class AutoCompletionHandler : IAutoCompleteHandler
{
// characters to start completion from
public char[] Separators { get; set; } = new char[] { ' ', '.', '/' };
// text - The current text entered in the console
// index - The index of the terminal cursor within {text}
public string[] GetSuggestions(string text, int index)
{
if (text.StartsWith("git "))
return new string[] { "init", "clone", "pull", "push" };
else
return null;
}
}
ReadLine.AutoCompletionHandler = new AutoCompletionHandler();
Note: If no "AutoCompletionHandler" is set, tab autocompletion will be disabled
Contributing
Contributions are highly welcome. If you have found a bug or if you have a feature request, please report them at this repository issues section.
Things you can help with:
- Achieve better command parity with GNU Readline.
- Add more test cases.
License
This project is licensed under the MIT license. See the [LICENSE](LICENSE) file for more info.
*Note that all licence references and agreements mentioned in the ReadLine README section above
are relevant to that project's source code only.