Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exit code #4

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
exit
Pandademic authored Mar 19, 2022
commit 896d6c3a1c01428047299ac56714583b87186dbe
27 changes: 25 additions & 2 deletions prompt.go
Original file line number Diff line number Diff line change
@@ -93,11 +93,34 @@ func prompt(osLogo string) {
if(viper.Get("prompt.segments.cwd") == true){
cwd , _ := os.Getwd()
homeVar := viper.Get("HOME")
prompt = prompt + bgYellow(white(" :"+""+trimPath(cwd,homeVar.(string))+" "))\
prompt = prompt + bgYellow(white(" :"+""+trimPath(cwd,homeVar.(string))+" "))
}
// icon
var icon string = viper.GetString("prompt.icon")
prompt = prompt + "" + cyan(icon) + " "
exitCode := viper.GetBool("prompt.options.exitCode")
code := viper.Get("?")
var lastExitCode string = code.(string)
if(exitCode != false){
if(runtime.GOOS == "windows"){
if(code = "False"){
prompt = prompt + "" + red(icon) + ""
}
else {
prompt = prompt + "" + icon + " "
}
}
else{
if(code != 0){
prompt = prompt + "" + red(icon) + " "
}
else {
prompt = prompt + "" + icon + " "
}
}
}
else{
prompt = prompt + "" + icon + " "
}
// print it out
fmt.Println(prompt)
}