All Projects → agolaszewski → Inquirer.cs

agolaszewski / Inquirer.cs

Licence: GPL-3.0 license
A collection of common interactive command line user interfaces. Port of Inquirer.js

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to Inquirer.cs

CLI-Autocomplete
Cross-platform flexible autocomplete library for your CLI applications.
Stars: ✭ 21 (-19.23%)
Mutual labels:  console, prompt
xontrib-prompt-bar
The bar prompt for xonsh shell with customizable sections and Starship support.
Stars: ✭ 27 (+3.85%)
Mutual labels:  console, prompt
enquirer
Stylish, intuitive and user-friendly prompts, for Node.js. Used by eslint, webpack, yarn, pm2, pnpm, RedwoodJS, FactorJS, salesforce, Cypress, Google Lighthouse, Generate, tencent cloudbase, lint-staged, gluegun, hygen, hardhat, AWS Amplify, GitHub Actions Toolkit, @airbnb/nimbus, and many others! Please follow Enquirer's author: https://github.…
Stars: ✭ 6,523 (+24988.46%)
Mutual labels:  console, prompt
xontrib-output-search
Get identifiers, paths, URLs and words from the previous command output and use them for the next command in xonsh shell.
Stars: ✭ 26 (+0%)
Mutual labels:  console
whaaaaat
Inquirer.js port to Python (https://www.npmjs.com/package/inquirer). people blame me for staling this project. I do not have time to work on this right now - whaaaaat do you want me to do? take it offline?
Stars: ✭ 73 (+180.77%)
Mutual labels:  prompt
taxjar.net
Sales Tax API Client for .NET / C#
Stars: ✭ 21 (-19.23%)
Mutual labels:  dot-net
congif
convert script(1) output to GIF
Stars: ✭ 52 (+100%)
Mutual labels:  console
Simplify.Web
Moved to https://github.com/SimplifyNet. Simplify.Web is a lightweight and fast server-side .NET web-framework based on MVC and OWIN for building HTTP based web-applications, RESTful APIs etc.
Stars: ✭ 23 (-11.54%)
Mutual labels:  dot-net
std
stdout, for humans.
Stars: ✭ 17 (-34.62%)
Mutual labels:  console
go-color
A lightweight, simple and cross-platform package to colorize text in terminals
Stars: ✭ 65 (+150%)
Mutual labels:  console
laravel-make-me
Extendable Interactive Make Command for Laravel
Stars: ✭ 36 (+38.46%)
Mutual labels:  console
phantomic
Pipe stdin to Phantom.JS
Stars: ✭ 20 (-23.08%)
Mutual labels:  console
leeks.js
Simple ANSI styling for your terminal
Stars: ✭ 12 (-53.85%)
Mutual labels:  console
colored-console
🌈 Add some color to your console >_
Stars: ✭ 74 (+184.62%)
Mutual labels:  console
slick
async ZSH prompt
Stars: ✭ 21 (-19.23%)
Mutual labels:  prompt
console-web-ui
Examples to show case how to build web based UI (that can be invoked using curl) for console applications using Javascript(NodeJS)
Stars: ✭ 28 (+7.69%)
Mutual labels:  console
raml-dotnet-parser-2
No description or website provided.
Stars: ✭ 17 (-34.62%)
Mutual labels:  dot-net
Lua-Obfuscator
Obfuscate your lua code because it's so easy to steal!
Stars: ✭ 69 (+165.38%)
Mutual labels:  console
tvoip
Terminal-based P2P VoIP application (TeamSpeak-/Skype-like voice chatting over LAN or Internet)
Stars: ✭ 34 (+30.77%)
Mutual labels:  console
multitextor
Multiplatform command line text editor.
Stars: ✭ 27 (+3.85%)
Mutual labels:  console

Inquirer.cs

A collection of common interactive command line user interfaces.

Clone of Inquirer.js

Installation

Install-Package Inquirer.cs

Prompt types

List

List<ConsoleColor> colors = Enum.GetValues(typeof(ConsoleColor)).Cast<ConsoleColor>().ToList();
Question.List("Choose favourite color", colors);

Raw List

List<ConsoleColor> colors = Enum.GetValues(typeof(ConsoleColor)).Cast<ConsoleColor>().ToList();
Question.RawList("Choose favourite color", colors);

Expand

var colors = new Dictionary<ConsoleKey, ConsoleColor>();
            colors.Add(ConsoleKey.B, ConsoleColor.Blue);
            colors.Add(ConsoleKey.C, ConsoleColor.Cyan);
            colors.Add(ConsoleKey.D, ConsoleColor.DarkBlue);

Question.ExtendedList("Choose favourite color", colors);

Checkbox

var colors = Enum.GetValues(typeof(ConsoleColor)).Cast<ConsoleColor>().ToList();
Question.Checkbox("Choose favourite colors", colors);

Confirm

Question.Confirm("Are you sure?");

Input

Question.Input("How are you?");
Question.Input<int>("2+2")

Password

Question.Password("Type password");

Menu

private static void MenuTest()
        {
            Question.Menu("Choose")
               .AddOption("PagingCheckboxTest", () => { PagingCheckboxTest(); })
               .AddOption("PagingRawListTest", () => { PagingRawListTest(); })
               .AddOption("PagingListTest", () => { PagingListTest(); })
               .AddOption("InputTest", () => { InputTest(); })
               .AddOption("PasswordTest", () => { PasswordTest(); })
               .AddOption("ListTest", () => { ListTest(); })
               .AddOption("ListRawTest", () => { ListRawTest(); })
               .AddOption("ListCheckboxTest", () => { ListCheckboxTest(); })
               .AddOption("ListExtendedTest", () => { ListExtendedTest(); })
               .AddOption("ConfirmTest", () => { ConfirmTest(); }).Prompt();
        }

Extensions

Change the number of lines that will be rendered when using list, rawList, or checkbox.

.Page(int pageSize)

Default value(s) to use if nothing is entered.

.WithDefaultValue(...)
args:
TResult defaultValue
List<TResult> defaultValues : for list types and types implementing IComparable
Func<TResult, bool> compareTo : for list types not implementing IComparable

Chosen value displayed for final confirmation

For password type, user have to confirm password by typing it again

.WithConfirmation()

Set display name for complex type

.WithConvertToString(Func<TResult, string> fn)

Should return true if the value is valid, and an error message (String) otherwise. If false is returned, a default error message is provided.

.WithValidation(Func<TResult, bool> fn, string errorMessage)
.WithValidation(Func<TResult, bool> fn, Func<TResult, string> errorMessageFn)

Inquirer

_test = new Inquirer();

Inquirer is for preserving history It supports

  • navigation
  • optional prompts
  • hierarchical prompts
string answer = string.Empty;
Inquirer.Prompt(Question.Input("1")).Bind(() => answer);
Inquirer.Prompt(Question.Input("2")).Bind(() => answer);
Inquirer.Prompt(() =>
{
    if (answer.Length > 5)
    {
        return Question.Input("3");
    }

    return null;
}).Then(answer2 =>
{
    Inquirer.Prompt(Question.Input("3.1")).Bind(() => answer);
    Inquirer.Prompt(Question.Input("3.2")).Bind(() => answer);
    Inquirer.Prompt(Question.Input("3.3")).Bind(() => answer);
});
Inquirer.Go();
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].