package main import ( "fmt" "path/filepath" "strings" ) // banner is the colored startup line: name/"v"/info white-bold, version yellow, // path green. func banner() string { if useColor { wb := cBold + cWhite return fmt.Sprintf("%smgsh%s %sv%s%s%s%s %s%s,%s %s%s%s", wb, cReset, // mgsh wb, cReset, cYellow, VERSION, cReset, // v (white) + version (yellow) wb, INFO, cReset, // mwx'2026, (white) cGreen, BASE, cReset) // path (green) } return fmt.Sprintf("mgsh v%s %s, %s", VERSION, INFO, BASE) } func promptString() string { if useColor { return coloredPrompt() } return plainPrompt() } func plainPrompt() string { base := filepath.Base(BASE) if PRJ != "" && isDir(BASE+"/"+PRJ) { p := base + "/" + PRJ + BPLSTATE if BRANCH != "" { p += " (" + BRANCH if DIRTY { p += "*" } p += ")" } return p + " > " } return base + " > " } func coloredPrompt() string { var b strings.Builder b.WriteString(cBold + cViolet + "< " + cReset) b.WriteString(cBlue + filepath.Base(BASE) + cReset) if PRJ != "" && isDir(BASE+"/"+PRJ) { b.WriteString(cBold + cWhite + "/" + cReset + cBold + cGreen + PRJ + cReset) if BPLSTATE != "" { b.WriteString(cRed + BPLSTATE + cReset) } if BRANCH != "" { b.WriteString(cDark + " (" + cReset + cBlue + BRANCH + cReset) if DIRTY { b.WriteString(cRed + "*" + cReset) } b.WriteString(cDark + ")" + cReset) } } b.WriteString(" " + cBold + cViolet + ">" + cReset + " ") return b.String() }