Actions are actions that can be performed by a shell.
| 10 | |
| 11 | // Actions are actions that can be performed by a shell. |
| 12 | type Actions interface { |
| 13 | // ReadLine reads a line from standard input. |
| 14 | ReadLine() string |
| 15 | // ReadLineErr is ReadLine but returns error as well |
| 16 | ReadLineErr() (string, error) |
| 17 | // ReadLineWithDefault reads a line from standard input with default value. |
| 18 | ReadLineWithDefault(string) string |
| 19 | // ReadPassword reads password from standard input without echoing the characters. |
| 20 | // Note that this only works as expected when the standard input is a terminal. |
| 21 | ReadPassword() string |
| 22 | // ReadPasswordErr is ReadPassword but returns error as well |
| 23 | ReadPasswordErr() (string, error) |
| 24 | // ReadMultiLinesFunc reads multiple lines from standard input. It passes each read line to |
| 25 | // f and stops reading when f returns false. |
| 26 | ReadMultiLinesFunc(f func(string) bool) string |
| 27 | // ReadMultiLines reads multiple lines from standard input. It stops reading when terminator |
| 28 | // is encountered at the end of the line. It returns the lines read including terminator. |
| 29 | // For more control, use ReadMultiLinesFunc. |
| 30 | ReadMultiLines(terminator string) string |
| 31 | // Println prints to output and ends with newline character. |
| 32 | Println(val ...interface{}) |
| 33 | // Print prints to output. |
| 34 | Print(val ...interface{}) |
| 35 | // Printf prints to output using string format. |
| 36 | Printf(format string, val ...interface{}) |
| 37 | // ShowPaged shows a paged text that is scrollable. |
| 38 | // This leverages on "less" for unix and "more" for windows. |
| 39 | ShowPaged(text string) error |
| 40 | // ShowPagedReader shows a paged text that is scrollable, from a reader source. |
| 41 | // This leverages on "less" for unix and "more" for windows. |
| 42 | ShowPagedReader(r io.Reader) error |
| 43 | // MultiChoice presents options to the user. |
| 44 | // returns the index of the selection or -1 if nothing is |
| 45 | // selected. |
| 46 | // text is displayed before the options. |
| 47 | MultiChoice(options []string, text string) int |
| 48 | // Checklist is similar to MultiChoice but user can choose multiple variants using Space. |
| 49 | // init is initially selected options. |
| 50 | Checklist(options []string, text string, init []int) []int |
| 51 | // SetPrompt sets the prompt string. The string to be displayed before the cursor. |
| 52 | SetPrompt(prompt string) |
| 53 | // SetMultiPrompt sets the prompt string used for multiple lines. The string to be displayed before |
| 54 | // the cursor; starting from the second line of input. |
| 55 | SetMultiPrompt(prompt string) |
| 56 | // SetMultiChoicePrompt sets the prompt strings used for MultiChoice(). |
| 57 | SetMultiChoicePrompt(prompt, spacer string) |
| 58 | // SetChecklistOptions sets the strings representing the options of Checklist(). |
| 59 | // The generated string depends on SetMultiChoicePrompt() also. |
| 60 | SetChecklistOptions(open, selected string) |
| 61 | // ShowPrompt sets whether prompt should show when requesting input for ReadLine and ReadPassword. |
| 62 | // Defaults to true. |
| 63 | ShowPrompt(show bool) |
| 64 | // Cmds returns all the commands added to the shell. |
| 65 | Cmds() []*Cmd |
| 66 | // HelpText returns the computed help of top level commands. |
| 67 | HelpText() string |
| 68 | // ClearScreen clears the screen. Same behaviour as running 'clear' in unix terminal or 'cls' in windows cmd. |
| 69 | ClearScreen() error |
no outgoing calls
no test coverage detected