From 0c15996d83354dae75b137be5ffc7aee1c3c1052 Mon Sep 17 00:00:00 2001 From: TorchedSammy <38820196+TorchedSammy@users.noreply.github.com> Date: Wed, 13 Apr 2022 09:53:30 -0400 Subject: [PATCH] docs: update doc for prompt function --- api.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/api.go b/api.go index 606817e..dfd413b 100644 --- a/api.go +++ b/api.go @@ -305,7 +305,7 @@ func hlread(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) { } /* -prompt(str) +prompt(str, typ?) Changes the shell prompt to `str` There are a few verbs that can be used in the prompt text. These will be formatted and replaced with the appropriate values. @@ -313,6 +313,7 @@ These will be formatted and replaced with the appropriate values. `%u` - Name of current user `%h` - Hostname of device --- @param str string +--- @param typ string Type of prompt, being left or right. Left by default. */ func hlprompt(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) { err := c.Check1Arg() @@ -337,8 +338,8 @@ func hlprompt(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) { case "left": prompt = p lr.SetPrompt(fmtPrompt(prompt)) - case "right": - lr.SetRightPrompt(fmtPrompt(p)) + case "right": lr.SetRightPrompt(fmtPrompt(p)) + default: return nil, errors.New("expected prompt type to be right or left, got " + typ) } return c.Next(), nil