I am implementing a CLI and there I have a select list to choose from an array of values.
cellTemplate := &promptui.SelectTemplates{
Label: "{{ . }}",
Active: "\U000027A4 {{ .| cyan }}",
Inactive: " {{ . | white }}",
Selected: green("\U00002713 ") + boldWhite("cell context: ") + "{{ . | faint }}",
Help: faint("[Use arrow keys]"),
}
cellPrompt := promptui.Select{
Label: yellow("?") + " Select a cell cluster",
Items: <Array of items>,
Templates: cellTemplate,
}
This works fine but once I select an item, the next time I list the items, I want to point it to the item I previously selected. If I selected second item, it when I enter the command to list items, it should look like this.
I can save get the key and value of the previously selected item. Any idea?
Is it possible?