promptui | Interactive prompt for command-line applications | Command Line Interface library
kandi X-RAY | promptui Summary
kandi X-RAY | promptui Summary
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.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of promptui
promptui Key Features
promptui Examples and Code Snippets
Community Discussions
Trending Discussions on promptui
QUESTION
I'm fairly new to Go, and am a little puzzled how to achieve this:
I'm using promptui to give the user a list of options to pick from. I want to assign a function to each option, when selected - the chosen item's function gets called.
The closest example for the implementation is this, which is in their docs: https://github.com/manifoldco/promptui/blob/master/_examples/custom_select/main.go
Any help would be much appreciated. Thanks!
...ANSWER
Answered 2020-May-12 at 23:26Add a function field to the struct and initialize:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install promptui
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page