diff --git a/gosh.go b/gosh.go index 953e113..17d0f8d 100644 --- a/gosh.go +++ b/gosh.go @@ -41,7 +41,6 @@ func New() *Goshell { // Init initializes the shell with the given context func (gosh *Goshell) Init(ctx context.Context) error { gosh.ctx = ctx - gosh.printSplash() return gosh.loadCommands() } @@ -85,24 +84,6 @@ func (gosh *Goshell) loadCommands() error { return nil } -// TODO delegate splash to a plugin -func (gosh *Goshell) printSplash() { - fmt.Println(` - 888 - 888 - 888 - .d88b. .d88b. .d8888b 88888b. -d88P"88bd88""88b88K 888 "88b -888 888888 888"Y8888b.888 888 -Y88b 888Y88..88P X88888 888 - "Y88888 "Y88P" 88888P'888 888 - 888 -Y8b d88P - "Y88P" - - `) -} - // Open opens the shell for the given reader func (gosh *Goshell) Open(r *bufio.Reader) { loopCtx := gosh.ctx @@ -196,7 +177,7 @@ func main() { shell := New() if err := shell.Init(ctx); err != nil { - fmt.Print("\n\nfailed to initialize:", err) + fmt.Println("\n\nfailed to initialize:\n", err) os.Exit(1) } diff --git a/plugins/00_splash.go b/plugins/00_splash.go new file mode 100644 index 0000000..3ecb78a --- /dev/null +++ b/plugins/00_splash.go @@ -0,0 +1,26 @@ +package main + +// this is on the back burner, not needed at the moment + +import ( + "context" + "fmt" + + "github.com/Merith-TK/gosh/api" +) + +type splashCmd string +type splashCmds struct{} + +func (t *splashCmds) Init(ctx context.Context) error { + // to set your splash, modify the text in the println statement below, multiline is supported + fmt.Println(`-------------------------`) + + return nil +} + +func (t *splashCmds) Registry() map[string]api.Command { + return map[string]api.Command{} +} + +var Commands splashCmds