Skip to content

Commit 285bf84

Browse files
authored
Merge pull request #99 from ugy/shell_rootcmd_accessor
Added rootCmd accessor to the shell
2 parents 9cabba1 + 8496f42 commit 285bf84

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

ishell.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,17 @@ func (s *Shell) Wait() {
104104
<-s.haltChan
105105
}
106106

107+
// RootCmd returns the shell's root command.
108+
func (s *Shell) RootCmd() *Cmd {
109+
return s.rootCmd
110+
}
111+
112+
// SetRootCmd sets the shell's root command.
113+
// Use with caution, this may affect the behaviour of the default completer.
114+
func (s *Shell) SetRootCmd(cmd *Cmd) {
115+
s.rootCmd = cmd
116+
}
117+
107118
func (s *Shell) stop() {
108119
if !s.Active() {
109120
return

0 commit comments

Comments
 (0)