From 0a4a589125d84b90a425336899ea4810edaa0a2a Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Mon, 1 Jul 2024 21:14:52 +0200 Subject: [PATCH] refactor: rename engine to prompt --- src/cli/config_export_image.go | 10 +++++----- src/cli/debug.go | 4 ++-- src/cli/print.go | 14 +++++++------- src/{engine => prompt}/debug.go | 2 +- src/{engine => prompt}/engine.go | 2 +- src/{engine => prompt}/engine_test.go | 2 +- src/{engine => prompt}/image.go | 2 +- src/{engine => prompt}/image_test.go | 2 +- src/{engine => prompt}/new.go | 2 +- src/{engine => prompt}/prompt.go | 2 +- src/{engine => prompt}/tooltip.go | 2 +- 11 files changed, 22 insertions(+), 22 deletions(-) rename src/{engine => prompt}/debug.go (99%) rename src/{engine => prompt}/engine.go (99%) rename src/{engine => prompt}/engine_test.go (99%) rename src/{engine => prompt}/image.go (99%) rename src/{engine => prompt}/image_test.go (99%) rename src/{engine => prompt}/new.go (98%) rename src/{engine => prompt}/prompt.go (99%) rename src/{engine => prompt}/tooltip.go (99%) diff --git a/src/cli/config_export_image.go b/src/cli/config_export_image.go index 93013301..3fceaf55 100644 --- a/src/cli/config_export_image.go +++ b/src/cli/config_export_image.go @@ -4,8 +4,8 @@ import ( "fmt" "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/prompt" "github.com/jandedobbeleer/oh-my-posh/src/shell" "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.AnsiColors = cfg.MakeColors() - eng := &engine.Engine{ + eng := &prompt.Engine{ Config: cfg, Env: env, } - prompt := eng.Primary() + primaryPrompt := eng.Primary() - imageCreator := &engine.ImageRenderer{ - AnsiString: prompt, + imageCreator := &prompt.ImageRenderer{ + AnsiString: primaryPrompt, Author: author, BgColor: bgColor, } diff --git a/src/cli/debug.go b/src/cli/debug.go index 9e8c714b..48afd451 100644 --- a/src/cli/debug.go +++ b/src/cli/debug.go @@ -6,8 +6,8 @@ import ( "github.com/jandedobbeleer/oh-my-posh/src/build" "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/prompt" "github.com/jandedobbeleer/oh-my-posh/src/shell" "github.com/jandedobbeleer/oh-my-posh/src/terminal" @@ -46,7 +46,7 @@ var debugCmd = &cobra.Command{ terminal.AnsiColors = cfg.MakeColors() terminal.Plain = plain - eng := &engine.Engine{ + eng := &prompt.Engine{ Config: cfg, Env: env, Plain: plain, diff --git a/src/cli/print.go b/src/cli/print.go index 79807f3e..44ac08b0 100644 --- a/src/cli/print.go +++ b/src/cli/print.go @@ -3,8 +3,8 @@ package cli import ( "fmt" - "github.com/jandedobbeleer/oh-my-posh/src/engine" "github.com/jandedobbeleer/oh-my-posh/src/platform" + "github.com/jandedobbeleer/oh-my-posh/src/prompt" "github.com/spf13/cobra" ) @@ -68,26 +68,26 @@ var printCmd = &cobra.Command{ Column: column, } - eng := engine.New(flags) + eng := prompt.New(flags) defer eng.Env.Close() switch args[0] { case "debug": - fmt.Print(eng.ExtraPrompt(engine.Debug)) + fmt.Print(eng.ExtraPrompt(prompt.Debug)) case "primary": fmt.Print(eng.Primary()) case "secondary": - fmt.Print(eng.ExtraPrompt(engine.Secondary)) + fmt.Print(eng.ExtraPrompt(prompt.Secondary)) case "transient": - fmt.Print(eng.ExtraPrompt(engine.Transient)) + fmt.Print(eng.ExtraPrompt(prompt.Transient)) case "right": fmt.Print(eng.RPrompt()) case "tooltip": fmt.Print(eng.Tooltip(command)) case "valid": - fmt.Print(eng.ExtraPrompt(engine.Valid)) + fmt.Print(eng.ExtraPrompt(prompt.Valid)) case "error": - fmt.Print(eng.ExtraPrompt(engine.Error)) + fmt.Print(eng.ExtraPrompt(prompt.Error)) default: _ = cmd.Help() } diff --git a/src/engine/debug.go b/src/prompt/debug.go similarity index 99% rename from src/engine/debug.go rename to src/prompt/debug.go index 38da86bb..1adf1548 100644 --- a/src/engine/debug.go +++ b/src/prompt/debug.go @@ -1,4 +1,4 @@ -package engine +package prompt import ( "fmt" diff --git a/src/engine/engine.go b/src/prompt/engine.go similarity index 99% rename from src/engine/engine.go rename to src/prompt/engine.go index 782c61f4..99b1d9de 100644 --- a/src/engine/engine.go +++ b/src/prompt/engine.go @@ -1,4 +1,4 @@ -package engine +package prompt import ( "strings" diff --git a/src/engine/engine_test.go b/src/prompt/engine_test.go similarity index 99% rename from src/engine/engine_test.go rename to src/prompt/engine_test.go index 4871ccf8..6a2a0032 100644 --- a/src/engine/engine_test.go +++ b/src/prompt/engine_test.go @@ -1,4 +1,4 @@ -package engine +package prompt import ( "errors" diff --git a/src/engine/image.go b/src/prompt/image.go similarity index 99% rename from src/engine/image.go rename to src/prompt/image.go index 688bf0c2..6c639bdb 100644 --- a/src/engine/image.go +++ b/src/prompt/image.go @@ -20,7 +20,7 @@ // https://github.com/homeport/termshot -package engine +package prompt import ( "archive/zip" diff --git a/src/engine/image_test.go b/src/prompt/image_test.go similarity index 99% rename from src/engine/image_test.go rename to src/prompt/image_test.go index 0b0a2efc..1992cb0c 100644 --- a/src/engine/image_test.go +++ b/src/prompt/image_test.go @@ -1,4 +1,4 @@ -package engine +package prompt import ( "os" diff --git a/src/engine/new.go b/src/prompt/new.go similarity index 98% rename from src/engine/new.go rename to src/prompt/new.go index eeee856a..1fbca1e5 100644 --- a/src/engine/new.go +++ b/src/prompt/new.go @@ -1,4 +1,4 @@ -package engine +package prompt import ( "github.com/jandedobbeleer/oh-my-posh/src/config" diff --git a/src/engine/prompt.go b/src/prompt/prompt.go similarity index 99% rename from src/engine/prompt.go rename to src/prompt/prompt.go index 06937f8c..8ba8df1d 100644 --- a/src/engine/prompt.go +++ b/src/prompt/prompt.go @@ -1,4 +1,4 @@ -package engine +package prompt import ( "fmt" diff --git a/src/engine/tooltip.go b/src/prompt/tooltip.go similarity index 99% rename from src/engine/tooltip.go rename to src/prompt/tooltip.go index 0eb7075f..e11d556f 100644 --- a/src/engine/tooltip.go +++ b/src/prompt/tooltip.go @@ -1,4 +1,4 @@ -package engine +package prompt import ( "strings"