mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-02-02 05:41:10 -08:00
a8f246064e
For supported shells: - Correct string quoting. - Reorganize initialization scripts to improve maintainability.
40 lines
722 B
Go
40 lines
722 B
Go
package shell
|
|
|
|
import (
|
|
_ "embed"
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
//go:embed scripts/omp.fish
|
|
var fishInit string
|
|
|
|
func (f Feature) Fish() Code {
|
|
switch f {
|
|
case Transient:
|
|
return "set --global _omp_transient_prompt 1"
|
|
case FTCSMarks:
|
|
return "set --global _omp_ftcs_marks 1"
|
|
case PromptMark:
|
|
return "set --global _omp_prompt_mark 1"
|
|
case Tooltips:
|
|
return "enable_poshtooltips"
|
|
case Upgrade:
|
|
return unixUpgrade
|
|
case Notice:
|
|
return unixNotice
|
|
case RPrompt, PoshGit, Azure, LineError, Jobs, CursorPositioning:
|
|
fallthrough
|
|
default:
|
|
return ""
|
|
}
|
|
}
|
|
|
|
func quoteFishStr(str string) string {
|
|
if len(str) == 0 {
|
|
return "''"
|
|
}
|
|
|
|
return fmt.Sprintf("'%s'", strings.NewReplacer(`\`, `\\`, "'", `\'`).Replace(str))
|
|
}
|