manifoldco / promptui

Interactive prompt for command-line applications
https://www.manifold.co
BSD 3-Clause "New" or "Revised" License
6.03k stars 333 forks source link

Feature: Allow checkbox in select #156

Closed rubiin closed 2 years ago

rubiin commented 4 years ago

So I am building a cli which allows user to select multiple items and run some operation on them. How can we achieve this ?

chriswalz commented 4 years ago

I'm also interested in this

ahume commented 3 years ago

I've put together a spike of this, to prove the basic concept.

multi-select

Is there interest in adding this feature in principal? Or is this best left in our own fork?

package main

import (
    "fmt"

    "github.com/manifoldco/promptui"
)

func main() {
    prompt := promptui.MultiSelect{
        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 chose %q\n", result)
}
IsQiao commented 3 years ago

this is alternative https://github.com/AlecAivazis/survey

rubiin commented 3 years ago

this is alternative https://github.com/AlecAivazis/survey

that looks way better for my project, thanks