Giter VIP home page Giter VIP logo

autoprompt's Introduction

AutoPrompt Travis NuGet

Auto complete command prompts for C# .Net console apps. This library provides APIs that can be used to accept input from the command line with added functionality.

The user can supply prefilled input, edit it, use Up or Down arrow to go throught the input options supplied or even press a key to go to the closest maching option.

For example, When the prompt is for a path, the user can navigate down a directory structure with choosing prefilled options with Up/Down arrow keys, typing \ to drill down into the directory and repeat the same process. This allows the user to key in a path with a fraction of keystores as opposed to typing the full path or switching context and pasting the path from another app.

Installation

To install AutoPrompt, run the following command in the Package Manager Console

PM> Install-Package rohankapoor.AutoPrompt

Or

In Visual Studio solution, right click and Manage Nuget Packages. Search online for 'rohankapoor' or 'autoprompt'.

Overview of APIs

Prompt for path of directory or file

Prompts the user on command line for a path. This paths are auto completed based on the drive/directory/file choose. User can:

  • Press Up/Down arrow to choose next drive or directory or file in current path
  • Press \ to navigate into the drive or directory (the Up/Down arrow to go through current files and dirs)
  • Key in a character after \ to go to the closest matching file or directory on current path
  • Backspace to edit the path

Usage:

string userInput = AutoPrompt.GetPath("Choose certification file :\n\tUp/down arrow to go through files in current directory.\n\t'\\' to step into directory\n\tBackspace to edit\n\tOr just type to go to nearest search match\n\n>");

Prompt with initial input

Prompts the user for input on command line with a prompt string as well as a pre filled input which can be edited

Usage:

string userInput = AutoPrompt.PromptForInput("How do you feel? (Press backspce to edit) :", "Awesome");

Prompt with a set of options

Prompts the user for input on command line with a prompt string as well as a set of option that can be choosen using Up and Down arrow. The input is editable as well

Usage:

string userInput = AutoPrompt.PromptForInput("Choose occupation (Press up/down arrow to choose) :", new string[] { "Engineer", "Scientist", "Salesman", "Manager", "TopManagement" });

Prompt with a set of non-editable options

Prompts the user for input on command line with a prompt string as well as a set of option. User can only choose among various options using Up and Down arrow.

Usage:

string userInput = AutoPrompt.PromptForInput("Choose occupation (Press up/down arrow to choose) :", new string[] { "Engineer", "Scientist", "Salesman", "Manager", "TopManagement" }, false);

Prompt with a set of searchable options

Prompts the user for input on command line with a prompt string as well as a set of option that can be choosen using Up and Down arrow. The input is editable and searchable.

To search, key in an alphabet and the option closest match to the char key'd in will be set as user input

Usage:

string userInput = AutoPrompt.PromptForInput_Searchable("Choose city (Press up/down arrow or type name) :", new string[] { "New York City", "San Fransisco", "New Delhi", "Bangalore", "Tokyo" });

Prompt for password

Prompts the user for password input on command line. The entered password is masked with * echoded on the console with each characted of the password key'd in

Usage:

string userInput = AutoPrompt.GetPassword("Enter password :");

autoprompt's People

Contributors

ricphiri avatar rohankapoor avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.