All Projects → tonerdo → Readline

tonerdo / Readline

Licence: mit
A Pure C# GNU-Readline like library for .NET/.NET Core

Programming Languages

csharp
926 projects

Projects that are alternatives of or similar to Readline

Readline Sync
Synchronous Readline for interactively running to have a conversation with the user via a console(TTY).
Stars: ✭ 601 (-18.78%)
Mutual labels:  readline
Dsharpplus
A .NET Standard library for making bots using the Discord API.
Stars: ✭ 635 (-14.19%)
Mutual labels:  dotnet-core
Aspnetcore Developer Roadmap
Roadmap to becoming an ASP.NET Core developer in 2021
Stars: ✭ 8,248 (+1014.59%)
Mutual labels:  dotnet-core
Steeltoe
Steeltoe .NET Core Components: CircuitBreaker, Configuration, Connectors, Discovery, Logging, Management, and Security
Stars: ✭ 612 (-17.3%)
Mutual labels:  dotnet-core
Botbuilder Dotnet
Welcome to the Bot Framework SDK for .NET repository, which is the home for the libraries and packages that enable developers to build sophisticated bot applications using .NET.
Stars: ✭ 631 (-14.73%)
Mutual labels:  dotnet-core
Practical Aspnetcore
Practical samples of ASP.NET Core 2.1, 2.2, 3.1, 5.0 and 6.0 projects you can use. Readme contains explanations on all projects.
Stars: ✭ 6,199 (+737.7%)
Mutual labels:  dotnet-core
Firely Net Sdk
The official Firely .NET SDK for HL7 FHIR
Stars: ✭ 560 (-24.32%)
Mutual labels:  dotnet-core
Imgbot
An Azure Function solution to crawl through all of your image files in GitHub and losslessly compress them. This will make the file size go down, but leave the dimensions and quality untouched. Once it's done, ImgBot will open a pull request for you to review and merge. [email protected]
Stars: ✭ 732 (-1.08%)
Mutual labels:  dotnet-core
Featuretoggle
Simple, reliable feature toggles in .NET
Stars: ✭ 641 (-13.38%)
Mutual labels:  dotnet-core
Flubucore
A cross platform build and deployment automation system for building projects and executing deployment scripts using C# code.
Stars: ✭ 695 (-6.08%)
Mutual labels:  dotnet-core
Mathsharp
A vector and matrix library written in C# using hardware intrinsics
Stars: ✭ 616 (-16.76%)
Mutual labels:  dotnet-core
Mathparser.org Mxparser
Math Parser Java Android C# .NET/MONO (.NET Framework, .NET Core, .NET Standard, .NET PCL, Xamarin.Android, Xamarin.iOS) CLS Library - a super easy, rich and flexible mathematical expression parser (expression evaluator, expression provided as plain text / strings) for JAVA and C#. Main features: rich built-in library of operators, constants, math functions, user defined: arguments, functions, recursive functions and general recursion (direct / indirect). Additionally parser provides grammar and internal syntax checking.
Stars: ✭ 624 (-15.68%)
Mutual labels:  dotnet-core
Shriek Fx
An easy-to-use rapid development framework developed on the basis of.NET Core 2.0, following the constraints of domain Driven Design (DDD) specifications, combined with the CQRS architecture to provide the infrastructure for event-driven, event backtracking, responsiveness, and more. Let developers enjoy the true meaning of object-oriented design patterns brought by the aesthetic.
Stars: ✭ 644 (-12.97%)
Mutual labels:  dotnet-core
Dnsserver
Technitium DNS Server
Stars: ✭ 603 (-18.51%)
Mutual labels:  dotnet-core
Nopcommerce
The most popular open-source eCommerce shopping cart solution based on ASP.NET Core
Stars: ✭ 6,827 (+822.57%)
Mutual labels:  dotnet-core
Minecase
Minecraft server based on Orleans
Stars: ✭ 581 (-21.49%)
Mutual labels:  dotnet-core
Ryujinx
Experimental Nintendo Switch Emulator written in C#
Stars: ✭ 10,983 (+1384.19%)
Mutual labels:  dotnet-core
Ocelot
.NET core API Gateway
Stars: ✭ 6,675 (+802.03%)
Mutual labels:  dotnet-core
Aelf
A scalable cloud computing blockchain platform
Stars: ✭ 720 (-2.7%)
Mutual labels:  dotnet-core
Electron.net
Build cross platform desktop apps with ASP.NET Core (Razor Pages, MVC, Blazor).
Stars: ✭ 6,074 (+720.81%)
Mutual labels:  dotnet-core

Windows build status License: MIT NuGet version

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 file for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].