Selectpromptui.Select
CursorPos is the initial position of the cursor.
HideHelp sets whether to hide help information.
HideSelected sets whether to hide the text displayed after an item is successfully selected.
IsVimMode sets whether to use vim mode when using readline in the command prompt. Look at
https://godoc.org/github.com/chzyer/readline#Config for more information on readline.
Items are the items to display inside the list. It expect a slice of any kind of values, including strings.
If using a slice of strings, promptui will use those strings directly into its base templates or the
provided templates. If using any other type in the slice, it will attempt to transform it into a string
before giving it to its templates. Custom templates will override this behavior if using the dot notation
inside the templates.
For example, `{{ .Name }}` will display the name property of a struct.
Keys is the set of keys used in select mode to control the command line interface. See the SelectKeys docs for
more info.
Label is the text displayed on top of the list to direct input. The IconInitial value "?" will be
appended automatically to the label so it does not need to be added.
The value for Label can be a simple string or a struct that will need to be accessed by dot notation
inside the templates. For example, `{{ .Name }}` will display the name property of a struct.
A function that determines how to render the cursor
Searcher is a function that can be implemented to refine the base searching algorithm in selects.
Search is a function that will receive the searched term and the item's index and should return a boolean
for whether or not the terms are alike. It is unimplemented by default and search will not work unless
it is implemented.
Size is the number of items that should appear on the select before scrolling is necessary. Defaults to 5.
StartInSearchMode sets whether or not the select mode should start in search mode or selection mode.
For search mode to work, the Search property must be implemented.
Select.Stdinio.ReadCloserSelect.Stdoutio.WriteCloser
Templates can be used to customize the select output. If nil is passed, the
default templates are used. See the SelectTemplates docs for more info.
controllerinternal.IssueControllernextMenupreviousMenuSelect.list*list.List(*T) AttachController(controller internal.Controller)(*T) Render() (int, string, error)
Run executes the select list. It displays the label and the list of items, asking the user to chose any
value within to list. Run will keep the prompt alive until it has been canceled from
the command prompt or it has received a valid value. It will return the value and an error if any
occurred during the select's execution.
RunCursorAt executes the select list, initializing the cursor to the given
position. Invalid cursor positions will be clamped to valid values. It
displays the label and the list of items, asking the user to chose any value
within to list. Run will keep the prompt alive until it has been canceled
from the command prompt or it has received a valid value. It will return
the value and an error if any occurred during the select's execution.
ScrollPosition returns the current scroll position.
(*T) innerRun(cursorPos, scroll int, top rune) (int, string, error)(*T) prepareTemplates() error(*T) renderDetails(item interface{}) [][]byte(*T) renderHelp(b bool) []byte(*T) setKeys()
*T : Menu
Selectpromptui.Select
CursorPos is the initial position of the cursor.
HideHelp sets whether to hide help information.
HideSelected sets whether to hide the text displayed after an item is successfully selected.
IsVimMode sets whether to use vim mode when using readline in the command prompt. Look at
https://godoc.org/github.com/chzyer/readline#Config for more information on readline.
Items are the items to display inside the list. It expect a slice of any kind of values, including strings.
If using a slice of strings, promptui will use those strings directly into its base templates or the
provided templates. If using any other type in the slice, it will attempt to transform it into a string
before giving it to its templates. Custom templates will override this behavior if using the dot notation
inside the templates.
For example, `{{ .Name }}` will display the name property of a struct.
Keys is the set of keys used in select mode to control the command line interface. See the SelectKeys docs for
more info.
Label is the text displayed on top of the list to direct input. The IconInitial value "?" will be
appended automatically to the label so it does not need to be added.
The value for Label can be a simple string or a struct that will need to be accessed by dot notation
inside the templates. For example, `{{ .Name }}` will display the name property of a struct.
A function that determines how to render the cursor
Searcher is a function that can be implemented to refine the base searching algorithm in selects.
Search is a function that will receive the searched term and the item's index and should return a boolean
for whether or not the terms are alike. It is unimplemented by default and search will not work unless
it is implemented.
Size is the number of items that should appear on the select before scrolling is necessary. Defaults to 5.
StartInSearchMode sets whether or not the select mode should start in search mode or selection mode.
For search mode to work, the Search property must be implemented.
Select.Stdinio.ReadCloserSelect.Stdoutio.WriteCloser
Templates can be used to customize the select output. If nil is passed, the
default templates are used. See the SelectTemplates docs for more info.
controllerinternal.ProjectControllernextMenupreviousMenuSelect.list*list.List(*T) AttachController(controller internal.Controller)(*T) Render() (int, string, error)
Run executes the select list. It displays the label and the list of items, asking the user to chose any
value within to list. Run will keep the prompt alive until it has been canceled from
the command prompt or it has received a valid value. It will return the value and an error if any
occurred during the select's execution.
RunCursorAt executes the select list, initializing the cursor to the given
position. Invalid cursor positions will be clamped to valid values. It
displays the label and the list of items, asking the user to chose any value
within to list. Run will keep the prompt alive until it has been canceled
from the command prompt or it has received a valid value. It will return
the value and an error if any occurred during the select's execution.
ScrollPosition returns the current scroll position.
(*T) innerRun(cursorPos, scroll int, top rune) (int, string, error)(*T) prepareTemplates() error(*T) renderDetails(item interface{}) [][]byte(*T) renderHelp(b bool) []byte(*T) setKeys()
*T : Menu
Selectpromptui.Select
CursorPos is the initial position of the cursor.
HideHelp sets whether to hide help information.
HideSelected sets whether to hide the text displayed after an item is successfully selected.
IsVimMode sets whether to use vim mode when using readline in the command prompt. Look at
https://godoc.org/github.com/chzyer/readline#Config for more information on readline.
Items are the items to display inside the list. It expect a slice of any kind of values, including strings.
If using a slice of strings, promptui will use those strings directly into its base templates or the
provided templates. If using any other type in the slice, it will attempt to transform it into a string
before giving it to its templates. Custom templates will override this behavior if using the dot notation
inside the templates.
For example, `{{ .Name }}` will display the name property of a struct.
Keys is the set of keys used in select mode to control the command line interface. See the SelectKeys docs for
more info.
Label is the text displayed on top of the list to direct input. The IconInitial value "?" will be
appended automatically to the label so it does not need to be added.
The value for Label can be a simple string or a struct that will need to be accessed by dot notation
inside the templates. For example, `{{ .Name }}` will display the name property of a struct.
A function that determines how to render the cursor
Searcher is a function that can be implemented to refine the base searching algorithm in selects.
Search is a function that will receive the searched term and the item's index and should return a boolean
for whether or not the terms are alike. It is unimplemented by default and search will not work unless
it is implemented.
Size is the number of items that should appear on the select before scrolling is necessary. Defaults to 5.
StartInSearchMode sets whether or not the select mode should start in search mode or selection mode.
For search mode to work, the Search property must be implemented.
Select.Stdinio.ReadCloserSelect.Stdoutio.WriteCloser
Templates can be used to customize the select output. If nil is passed, the
default templates are used. See the SelectTemplates docs for more info.
controllerinternal.ControllernextMenuSelect.list*list.List(*T) AttachController(controller internal.Controller)(*T) Render() (int, string, error)
Run executes the select list. It displays the label and the list of items, asking the user to chose any
value within to list. Run will keep the prompt alive until it has been canceled from
the command prompt or it has received a valid value. It will return the value and an error if any
occurred during the select's execution.
RunCursorAt executes the select list, initializing the cursor to the given
position. Invalid cursor positions will be clamped to valid values. It
displays the label and the list of items, asking the user to chose any value
within to list. Run will keep the prompt alive until it has been canceled
from the command prompt or it has received a valid value. It will return
the value and an error if any occurred during the select's execution.
ScrollPosition returns the current scroll position.
(*T) innerRun(cursorPos, scroll int, top rune) (int, string, error)(*T) prepareTemplates() error(*T) renderDetails(item interface{}) [][]byte(*T) renderHelp(b bool) []byte(*T) setKeys()
*T : Menu
Selectpromptui.Select
CursorPos is the initial position of the cursor.
HideHelp sets whether to hide help information.
HideSelected sets whether to hide the text displayed after an item is successfully selected.
IsVimMode sets whether to use vim mode when using readline in the command prompt. Look at
https://godoc.org/github.com/chzyer/readline#Config for more information on readline.
Items are the items to display inside the list. It expect a slice of any kind of values, including strings.
If using a slice of strings, promptui will use those strings directly into its base templates or the
provided templates. If using any other type in the slice, it will attempt to transform it into a string
before giving it to its templates. Custom templates will override this behavior if using the dot notation
inside the templates.
For example, `{{ .Name }}` will display the name property of a struct.
Keys is the set of keys used in select mode to control the command line interface. See the SelectKeys docs for
more info.
Label is the text displayed on top of the list to direct input. The IconInitial value "?" will be
appended automatically to the label so it does not need to be added.
The value for Label can be a simple string or a struct that will need to be accessed by dot notation
inside the templates. For example, `{{ .Name }}` will display the name property of a struct.
A function that determines how to render the cursor
Searcher is a function that can be implemented to refine the base searching algorithm in selects.
Search is a function that will receive the searched term and the item's index and should return a boolean
for whether or not the terms are alike. It is unimplemented by default and search will not work unless
it is implemented.
Size is the number of items that should appear on the select before scrolling is necessary. Defaults to 5.
StartInSearchMode sets whether or not the select mode should start in search mode or selection mode.
For search mode to work, the Search property must be implemented.
Select.Stdinio.ReadCloserSelect.Stdoutio.WriteCloser
Templates can be used to customize the select output. If nil is passed, the
default templates are used. See the SelectTemplates docs for more info.
controllerinternal.ControllernextMenupreviousMenuSelect.list*list.List(*T) AttachController(controller internal.Controller)(*T) Render() (int, string, error)
Run executes the select list. It displays the label and the list of items, asking the user to chose any
value within to list. Run will keep the prompt alive until it has been canceled from
the command prompt or it has received a valid value. It will return the value and an error if any
occurred during the select's execution.
RunCursorAt executes the select list, initializing the cursor to the given
position. Invalid cursor positions will be clamped to valid values. It
displays the label and the list of items, asking the user to chose any value
within to list. Run will keep the prompt alive until it has been canceled
from the command prompt or it has received a valid value. It will return
the value and an error if any occurred during the select's execution.
ScrollPosition returns the current scroll position.
(*T) innerRun(cursorPos, scroll int, top rune) (int, string, error)(*T) prepareTemplates() error(*T) renderDetails(item interface{}) [][]byte(*T) renderHelp(b bool) []byte(*T) setKeys()
*T : Menu
Promptpromptui.Prompt
AllowEdit lets the user edit the default value. If false, any key press
other than <Enter> automatically clears the default value.
Default is the initial value for the prompt. This value will be displayed next to the prompt's label
and the user will be able to view or change it depending on the options.
HideEntered sets whether to hide the text after the user has pressed enter.
IsConfirm makes the prompt ask for a yes or no ([Y/N]) question rather than request an input. When set,
most properties related to input will be ignored.
IsVimMode enables vi-like movements (hjkl) and editing.
Label is the value displayed on the command line prompt.
The value for Label can be a simple string or a struct that will need to be accessed by dot notation
inside the templates. For example, `{{ .Name }}` will display the name property of a struct.
Mask is an optional rune that sets which character to display instead of the entered characters. This
allows hiding private information like passwords.
the Pointer defines how to render the cursor.
Prompt.Stdinio.ReadCloserPrompt.Stdoutio.WriteCloser
Templates can be used to customize the prompt output. If nil is passed, the
default templates are used. See the PromptTemplates docs for more info.
Validate is an optional function that fill be used against the entered value in the prompt to validate it.
controllerinternal.ControllernextMenupreviousMenu(*T) AttachController(controller internal.Controller)(*T) Render() (int, string, error)
Run executes the prompt. Its displays the label and default value if any, asking the user to enter a value.
Run will keep the prompt alive until it has been canceled from the command prompt or it has received a valid
value. It will return the value and an error if any occurred during the prompt's execution.
(*T) prepareTemplates() error
*T : Menu
Selectpromptui.Select
CursorPos is the initial position of the cursor.
HideHelp sets whether to hide help information.
HideSelected sets whether to hide the text displayed after an item is successfully selected.
IsVimMode sets whether to use vim mode when using readline in the command prompt. Look at
https://godoc.org/github.com/chzyer/readline#Config for more information on readline.
Items are the items to display inside the list. It expect a slice of any kind of values, including strings.
If using a slice of strings, promptui will use those strings directly into its base templates or the
provided templates. If using any other type in the slice, it will attempt to transform it into a string
before giving it to its templates. Custom templates will override this behavior if using the dot notation
inside the templates.
For example, `{{ .Name }}` will display the name property of a struct.
Keys is the set of keys used in select mode to control the command line interface. See the SelectKeys docs for
more info.
Label is the text displayed on top of the list to direct input. The IconInitial value "?" will be
appended automatically to the label so it does not need to be added.
The value for Label can be a simple string or a struct that will need to be accessed by dot notation
inside the templates. For example, `{{ .Name }}` will display the name property of a struct.
A function that determines how to render the cursor
Searcher is a function that can be implemented to refine the base searching algorithm in selects.
Search is a function that will receive the searched term and the item's index and should return a boolean
for whether or not the terms are alike. It is unimplemented by default and search will not work unless
it is implemented.
Size is the number of items that should appear on the select before scrolling is necessary. Defaults to 5.
StartInSearchMode sets whether or not the select mode should start in search mode or selection mode.
For search mode to work, the Search property must be implemented.
Select.Stdinio.ReadCloserSelect.Stdoutio.WriteCloser
Templates can be used to customize the select output. If nil is passed, the
default templates are used. See the SelectTemplates docs for more info.
controllerinternal.ControllernextMenupreviousMenuSelect.list*list.List(*T) AttachController(controller internal.Controller)(*T) Render() (int, string, error)
Run executes the select list. It displays the label and the list of items, asking the user to chose any
value within to list. Run will keep the prompt alive until it has been canceled from
the command prompt or it has received a valid value. It will return the value and an error if any
occurred during the select's execution.
RunCursorAt executes the select list, initializing the cursor to the given
position. Invalid cursor positions will be clamped to valid values. It
displays the label and the list of items, asking the user to chose any value
within to list. Run will keep the prompt alive until it has been canceled
from the command prompt or it has received a valid value. It will return
the value and an error if any occurred during the select's execution.
ScrollPosition returns the current scroll position.
(*T) innerRun(cursorPos, scroll int, top rune) (int, string, error)(*T) prepareTemplates() error(*T) renderDetails(item interface{}) [][]byte(*T) renderHelp(b bool) []byte(*T) setKeys()
*T : Menu
Package-Level Functions (total 6, all are exported)
The pages are generated with Goldsv0.3.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.