refactor: rename engine to prompt

This commit is contained in:
Jan De Dobbeleer 2024-07-01 21:14:52 +02:00 committed by Jan De Dobbeleer
parent 3c6abf6163
commit 0a4a589125
11 changed files with 22 additions and 22 deletions

View file

@ -4,8 +4,8 @@ import (
"fmt" "fmt"
"github.com/jandedobbeleer/oh-my-posh/src/config" "github.com/jandedobbeleer/oh-my-posh/src/config"
"github.com/jandedobbeleer/oh-my-posh/src/engine"
"github.com/jandedobbeleer/oh-my-posh/src/platform" "github.com/jandedobbeleer/oh-my-posh/src/platform"
"github.com/jandedobbeleer/oh-my-posh/src/prompt"
"github.com/jandedobbeleer/oh-my-posh/src/shell" "github.com/jandedobbeleer/oh-my-posh/src/shell"
"github.com/jandedobbeleer/oh-my-posh/src/terminal" "github.com/jandedobbeleer/oh-my-posh/src/terminal"
@ -72,15 +72,15 @@ Exports the config to an image file using customized output options.`,
terminal.BackgroundColor = shell.ConsoleBackgroundColor(env, cfg.TerminalBackground) terminal.BackgroundColor = shell.ConsoleBackgroundColor(env, cfg.TerminalBackground)
terminal.AnsiColors = cfg.MakeColors() terminal.AnsiColors = cfg.MakeColors()
eng := &engine.Engine{ eng := &prompt.Engine{
Config: cfg, Config: cfg,
Env: env, Env: env,
} }
prompt := eng.Primary() primaryPrompt := eng.Primary()
imageCreator := &engine.ImageRenderer{ imageCreator := &prompt.ImageRenderer{
AnsiString: prompt, AnsiString: primaryPrompt,
Author: author, Author: author,
BgColor: bgColor, BgColor: bgColor,
} }

View file

@ -6,8 +6,8 @@ import (
"github.com/jandedobbeleer/oh-my-posh/src/build" "github.com/jandedobbeleer/oh-my-posh/src/build"
"github.com/jandedobbeleer/oh-my-posh/src/config" "github.com/jandedobbeleer/oh-my-posh/src/config"
"github.com/jandedobbeleer/oh-my-posh/src/engine"
"github.com/jandedobbeleer/oh-my-posh/src/platform" "github.com/jandedobbeleer/oh-my-posh/src/platform"
"github.com/jandedobbeleer/oh-my-posh/src/prompt"
"github.com/jandedobbeleer/oh-my-posh/src/shell" "github.com/jandedobbeleer/oh-my-posh/src/shell"
"github.com/jandedobbeleer/oh-my-posh/src/terminal" "github.com/jandedobbeleer/oh-my-posh/src/terminal"
@ -46,7 +46,7 @@ var debugCmd = &cobra.Command{
terminal.AnsiColors = cfg.MakeColors() terminal.AnsiColors = cfg.MakeColors()
terminal.Plain = plain terminal.Plain = plain
eng := &engine.Engine{ eng := &prompt.Engine{
Config: cfg, Config: cfg,
Env: env, Env: env,
Plain: plain, Plain: plain,

View file

@ -3,8 +3,8 @@ package cli
import ( import (
"fmt" "fmt"
"github.com/jandedobbeleer/oh-my-posh/src/engine"
"github.com/jandedobbeleer/oh-my-posh/src/platform" "github.com/jandedobbeleer/oh-my-posh/src/platform"
"github.com/jandedobbeleer/oh-my-posh/src/prompt"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -68,26 +68,26 @@ var printCmd = &cobra.Command{
Column: column, Column: column,
} }
eng := engine.New(flags) eng := prompt.New(flags)
defer eng.Env.Close() defer eng.Env.Close()
switch args[0] { switch args[0] {
case "debug": case "debug":
fmt.Print(eng.ExtraPrompt(engine.Debug)) fmt.Print(eng.ExtraPrompt(prompt.Debug))
case "primary": case "primary":
fmt.Print(eng.Primary()) fmt.Print(eng.Primary())
case "secondary": case "secondary":
fmt.Print(eng.ExtraPrompt(engine.Secondary)) fmt.Print(eng.ExtraPrompt(prompt.Secondary))
case "transient": case "transient":
fmt.Print(eng.ExtraPrompt(engine.Transient)) fmt.Print(eng.ExtraPrompt(prompt.Transient))
case "right": case "right":
fmt.Print(eng.RPrompt()) fmt.Print(eng.RPrompt())
case "tooltip": case "tooltip":
fmt.Print(eng.Tooltip(command)) fmt.Print(eng.Tooltip(command))
case "valid": case "valid":
fmt.Print(eng.ExtraPrompt(engine.Valid)) fmt.Print(eng.ExtraPrompt(prompt.Valid))
case "error": case "error":
fmt.Print(eng.ExtraPrompt(engine.Error)) fmt.Print(eng.ExtraPrompt(prompt.Error))
default: default:
_ = cmd.Help() _ = cmd.Help()
} }

View file

@ -1,4 +1,4 @@
package engine package prompt
import ( import (
"fmt" "fmt"

View file

@ -1,4 +1,4 @@
package engine package prompt
import ( import (
"strings" "strings"

View file

@ -1,4 +1,4 @@
package engine package prompt
import ( import (
"errors" "errors"

View file

@ -20,7 +20,7 @@
// https://github.com/homeport/termshot // https://github.com/homeport/termshot
package engine package prompt
import ( import (
"archive/zip" "archive/zip"

View file

@ -1,4 +1,4 @@
package engine package prompt
import ( import (
"os" "os"

View file

@ -1,4 +1,4 @@
package engine package prompt
import ( import (
"github.com/jandedobbeleer/oh-my-posh/src/config" "github.com/jandedobbeleer/oh-my-posh/src/config"

View file

@ -1,4 +1,4 @@
package engine package prompt
import ( import (
"fmt" "fmt"

View file

@ -1,4 +1,4 @@
package engine package prompt
import ( import (
"strings" "strings"