mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2026-08-24 10:14:12 -05:00
fix(cli): pass --eval flag of init command correctly for Elvish
This commit is contained in:
committed by
Jan De Dobbeleer
parent
5138df9c36
commit
a79134e8ff
+2
-2
@@ -62,7 +62,7 @@ See the documentation to initialize your shell: https://ohmyposh.dev/docs/instal
|
||||
initCmd.Flags().BoolVarP(&printOutput, "print", "p", false, "print the init script")
|
||||
initCmd.Flags().BoolVarP(&strict, "strict", "s", false, "run in strict mode")
|
||||
initCmd.Flags().BoolVar(&debug, "debug", false, "enable/disable debug mode")
|
||||
initCmd.Flags().BoolVar(&eval, "eval", false, "output the prompt for eval")
|
||||
initCmd.Flags().BoolVar(&eval, "eval", false, "output the full init script for eval")
|
||||
|
||||
_ = initCmd.MarkPersistentFlagRequired("config")
|
||||
|
||||
@@ -167,7 +167,7 @@ func getFullCommand(cmd *cobra.Command, args []string) string {
|
||||
}
|
||||
|
||||
func initCache(sh string) {
|
||||
if !printOutput && eval && sh == shell.PWSH {
|
||||
if !printOutput && (sh == shell.PWSH || sh == shell.ELVISH) {
|
||||
cache.Init(sh)
|
||||
return
|
||||
}
|
||||
|
||||
+4
-1
@@ -58,6 +58,9 @@ func Init(env runtime.Environment, feats Features) string {
|
||||
if env.Flags().Strict {
|
||||
additionalParams += " --strict"
|
||||
}
|
||||
if env.Flags().Eval {
|
||||
additionalParams += " --eval"
|
||||
}
|
||||
|
||||
config := quotePwshOrElvishStr(env.Flags().ConfigPath)
|
||||
executable = quotePwshOrElvishStr(executable)
|
||||
@@ -66,7 +69,7 @@ func Init(env runtime.Environment, feats Features) string {
|
||||
|
||||
switch env.Flags().Shell {
|
||||
case PWSH:
|
||||
command = "(@(& %s init %s --config=%s --print --eval%s) -join \"`n\") | Invoke-Expression"
|
||||
command = "(@(& %s init %s --config=%s --print%s) -join \"`n\") | Invoke-Expression"
|
||||
case ELVISH:
|
||||
command = "eval ((external %s) init %s --config=%s --print%s | slurp)"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user