From b017ff3fbf272808839e344210741206d94d50da Mon Sep 17 00:00:00 2001 From: Stefan Majewsky Date: Sat, 19 Aug 2017 20:42:41 +0200 Subject: prettyprompt: show exit code of previous command --- pkg/prompt/main.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'pkg/prompt/main.go') diff --git a/pkg/prompt/main.go b/pkg/prompt/main.go index e5096e8..419b704 100644 --- a/pkg/prompt/main.go +++ b/pkg/prompt/main.go @@ -30,7 +30,7 @@ import ( //Exec executes the prettyprompt applet and returns an exit code (0 for //success, >0 for error). -func Exec() int { +func Exec(args []string) int { fields := []string{ getLoginField(), } @@ -39,6 +39,10 @@ func Exec() int { fields = appendUnlessEmpty(fields, getDeletedMessageField(cwd)) fields = appendUnlessEmpty(fields, getRepoStatusField(cwd.RepoRootPath)) fields = appendUnlessEmpty(fields, getTerminalField()) + //this field should always be last + if len(args) > 0 { + fields = appendUnlessEmpty(fields, getExitCodeField(args[0])) + } line := strings.Join(fields, " ") lineWidth := getPrintableLength(line) -- cgit v1.3.1