AlecAivazis / survey

A golang library for building interactive and accessible prompts with full support for windows and posix terminals.
MIT License
4.08k stars 350 forks source link

Add a message prompt feature #160

Closed rmfish closed 5 years ago

rmfish commented 5 years ago

Add a info/warning message prompt without any answer.

rmfish commented 5 years ago

In my case, i use the survey ask one by one, it always do something and send feedback between the asks. So i want a message prompt without answer to display the feedback :)

coryb commented 5 years ago

I am not sure I understand your use-case, but prompts are just a Go interface. You can provide your own implementation in your code. If you don't want to re-render the prompt with the answer you could just implement a no-op Cleanup function:

type MyConfirm struct {
    Confirm
}

func (my *MyConfirm) Cleanup(val interface{}) error {
    return nil
}
rmfish commented 5 years ago

I am not sure I understand your use-case, but prompts are just a Go interface. You can provide your own implementation in your code. If you don't want to re-render the prompt with the answer you could just implement a no-op Cleanup function:

type MyConfirm struct {
    Confirm
}

func (my *MyConfirm) Cleanup(val interface{}) error {
    return nil
}

Yes , it solve my some problems