aboutsummaryrefslogtreecommitdiff
path: root/pkg/prompt/main.go
diff options
context:
space:
mode:
authorStefan Majewsky <majewsky@gmx.net>2017-08-19 20:42:41 +0200
committerStefan Majewsky <majewsky@gmx.net>2017-08-19 20:42:41 +0200
commitb017ff3fbf272808839e344210741206d94d50da (patch)
tree1e51fdbe05e221d344f3112ee3e4dd5277aca12e /pkg/prompt/main.go
parent39cbf9b61a0a22f0f6310a1dbcbe3268c26d786a (diff)
downloadgofu-b017ff3fbf272808839e344210741206d94d50da.tar.gz
prettyprompt: show exit code of previous command
Diffstat (limited to 'pkg/prompt/main.go')
-rw-r--r--pkg/prompt/main.go6
1 files changed, 5 insertions, 1 deletions
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)