NewWithReadline creates a new shell with a custom readline instance.
(rl *readline.Instance)
| 81 | |
| 82 | // NewWithReadline creates a new shell with a custom readline instance. |
| 83 | func NewWithReadline(rl *readline.Instance) *Shell { |
| 84 | shell := &Shell{ |
| 85 | rootCmd: &Cmd{}, |
| 86 | reader: &shellReader{ |
| 87 | scanner: rl, |
| 88 | prompt: rl.Config.Prompt, |
| 89 | multiPrompt: defaultMultiPrompt, |
| 90 | showPrompt: true, |
| 91 | buf: &bytes.Buffer{}, |
| 92 | completer: readline.NewPrefixCompleter(), |
| 93 | }, |
| 94 | writer: rl.Config.Stdout, |
| 95 | autoHelp: true, |
| 96 | } |
| 97 | shell.Actions = &shellActionsImpl{Shell: shell} |
| 98 | shell.progressBar = newProgressBar(shell) |
| 99 | addDefaultFuncs(shell) |
| 100 | return shell |
| 101 | } |
| 102 | |
| 103 | // Start starts the shell but does not wait for it to stop. |
| 104 | func (s *Shell) Start() { |
no test coverage detected