All Projects → manifoldco → Promptui

manifoldco / Promptui

Licence: bsd-3-clause
Interactive prompt for command-line applications

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to Promptui

Prompts
❯ Lightweight, beautiful and user-friendly interactive prompts
Stars: ✭ 6,970 (+50.83%)
Mutual labels:  cli, command-line, interface
Micro Dev
The development environment for `micro`
Stars: ✭ 630 (-86.37%)
Mutual labels:  cli, command-line, interface
Sad
CLI search and replace | Space Age seD
Stars: ✭ 350 (-92.43%)
Mutual labels:  cli, command-line
Reminders Cli
A simple CLI for interacting with macOS reminders
Stars: ✭ 354 (-92.34%)
Mutual labels:  cli, command-line
Beats
A command-line drum machine. Convert a beat notated in YAML into a *.wav file.
Stars: ✭ 389 (-91.58%)
Mutual labels:  cli, command-line
Cmd2
cmd2 - quickly build feature-rich and user-friendly interactive command line applications in Python
Stars: ✭ 342 (-92.6%)
Mutual labels:  cli, command-line
Gulp Cli
Command Line Interface for gulp.
Stars: ✭ 347 (-92.49%)
Mutual labels:  cli, command-line
Kondo
Save disk space by cleaning non-essential files from software projects.
Stars: ✭ 373 (-91.93%)
Mutual labels:  cli, command-line
Caporal.js
A full-featured framework for building command line applications (cli) with node.js
Stars: ✭ 3,279 (-29.04%)
Mutual labels:  cli, command-line
Mri
Quickly scan for CLI flags and arguments
Stars: ✭ 394 (-91.47%)
Mutual labels:  cli, command-line
Triage
Interactive command-line GitHub issue & notification triaging tool.
Stars: ✭ 394 (-91.47%)
Mutual labels:  cli, command-line
Cocona
Micro-framework for .NET Core console application. Cocona makes it easy and fast to build console applications on .NET Core.
Stars: ✭ 398 (-91.39%)
Mutual labels:  cli, command-line
Xidel
Command line tool to download and extract data from HTML/XML pages or JSON-APIs, using CSS, XPath 3.0, XQuery 3.0, JSONiq or pattern matching. It can also create new or transformed XML/HTML/JSON documents.
Stars: ✭ 335 (-92.75%)
Mutual labels:  cli, command-line
Go Tea
Tea provides an Elm inspired functional framework for interactive command-line programs.
Stars: ✭ 329 (-92.88%)
Mutual labels:  cli, command-line
Gandi.cli
command line interface to Gandi.net products using the public API
Stars: ✭ 349 (-92.45%)
Mutual labels:  cli, command-line
Fd
A simple, fast and user-friendly alternative to 'find'
Stars: ✭ 19,851 (+329.58%)
Mutual labels:  cli, command-line
Tsukae
🧑‍💻📊 Show off your most used shell commands
Stars: ✭ 345 (-92.53%)
Mutual labels:  cli, command-line
Args
Toolkit for building command line interfaces
Stars: ✭ 399 (-91.37%)
Mutual labels:  cli, command-line
Whatspup
🔳 WhatsApp chat from commandline/console/cli using GoogleChrome puppeteer
Stars: ✭ 310 (-93.29%)
Mutual labels:  cli, command-line
Php Console
🖥 PHP CLI application library, provide console argument parse, console controller/command run, color style, user interactive, format information show and more. 功能全面的PHP命令行应用库。提供控制台参数解析, 命令运行,颜色风格输出, 用户信息交互, 特殊格式信息显示
Stars: ✭ 310 (-93.29%)
Mutual labels:  cli, command-line

promptui

Interactive prompt for command-line applications.

We built Promptui because we wanted to make it easy and fun to explore cloud services with manifold cli.

Code of Conduct | Contribution Guidelines

GitHub release GoDoc Travis Go Report Card License

Overview

promptui

Promptui is a library providing a simple interface to create command-line prompts for go. It can be easily integrated into spf13/cobra, urfave/cli or any cli go application.

Promptui has two main input modes:

  • Prompt provides a single line for user input. Prompt supports optional live validation, confirmation and masking the input.

  • Select provides a list of options to choose from. Select supports pagination, search, detailed view and custom templates.

For a full list of options check GoDoc.

Basic Usage

Prompt

package main

import (
	"errors"
	"fmt"
	"strconv"

	"github.com/manifoldco/promptui"
)

func main() {
	validate := func(input string) error {
		_, err := strconv.ParseFloat(input, 64)
		if err != nil {
			return errors.New("Invalid number")
		}
		return nil
	}

	prompt := promptui.Prompt{
		Label:    "Number",
		Validate: validate,
	}

	result, err := prompt.Run()

	if err != nil {
		fmt.Printf("Prompt failed %v\n", err)
		return
	}

	fmt.Printf("You choose %q\n", result)
}

Select

package main

import (
	"fmt"

	"github.com/manifoldco/promptui"
)

func main() {
	prompt := promptui.Select{
		Label: "Select Day",
		Items: []string{"Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
			"Saturday", "Sunday"},
	}

	_, result, err := prompt.Run()

	if err != nil {
		fmt.Printf("Prompt failed %v\n", err)
		return
	}

	fmt.Printf("You choose %q\n", result)
}

More Examples

See full list of examples

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].