mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-02-02 05:41:10 -08:00
refactor: remove shell name from plain init
This commit is contained in:
parent
820e28c85c
commit
992add9a78
|
@ -58,7 +58,7 @@ Exports the config to an image file using customized output options.`,
|
|||
defer env.Close()
|
||||
cfg := engine.LoadConfig(env)
|
||||
ansi := &color.Ansi{}
|
||||
ansi.InitPlain(shell.PLAIN)
|
||||
ansi.InitPlain()
|
||||
writerColors := cfg.MakeColors(env)
|
||||
writer := &color.AnsiWriter{
|
||||
Ansi: ansi,
|
||||
|
|
|
@ -31,7 +31,7 @@ var debugCmd = &cobra.Command{
|
|||
defer env.Close()
|
||||
cfg := engine.LoadConfig(env)
|
||||
ansi := &color.Ansi{}
|
||||
ansi.InitPlain(shell.PLAIN)
|
||||
ansi.InitPlain()
|
||||
writerColors := cfg.MakeColors(env)
|
||||
writer := &color.AnsiWriter{
|
||||
Ansi: ansi,
|
||||
|
|
|
@ -68,7 +68,7 @@ var printCmd = &cobra.Command{
|
|||
ansi.Init(env.Shell())
|
||||
var writer color.Writer
|
||||
if plain {
|
||||
ansi.InitPlain(env.Shell())
|
||||
ansi.InitPlain()
|
||||
writer = &color.PlainWriter{
|
||||
Ansi: ansi,
|
||||
}
|
||||
|
|
|
@ -128,7 +128,7 @@ func (a *Ansi) Init(shellName string) {
|
|||
}
|
||||
}
|
||||
|
||||
func (a *Ansi) InitPlain(shellName string) {
|
||||
func (a *Ansi) InitPlain() {
|
||||
a.Init(shell.PLAIN)
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ func TestFormatText(t *testing.T) {
|
|||
}
|
||||
for _, tc := range cases {
|
||||
a := Ansi{}
|
||||
a.InitPlain(shell.PLAIN)
|
||||
a.InitPlain()
|
||||
formattedText := a.formatText(tc.Text)
|
||||
assert.Equal(t, tc.Expected, formattedText, tc.Case)
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ func TestGetTitle(t *testing.T) {
|
|||
Folder: "vagrant",
|
||||
})
|
||||
ansi := &color.Ansi{}
|
||||
ansi.InitPlain(tc.ShellName)
|
||||
ansi.InitPlain()
|
||||
ct := &Title{
|
||||
Env: env,
|
||||
Ansi: ansi,
|
||||
|
@ -116,7 +116,7 @@ func TestGetConsoleTitleIfGethostnameReturnsError(t *testing.T) {
|
|||
HostName: "",
|
||||
})
|
||||
ansi := &color.Ansi{}
|
||||
ansi.InitPlain(tc.ShellName)
|
||||
ansi.InitPlain()
|
||||
ct := &Title{
|
||||
Env: env,
|
||||
Ansi: ansi,
|
||||
|
|
|
@ -53,7 +53,7 @@ func (b *Block) Init(env environment.Environment, writer color.Writer, ansi *col
|
|||
|
||||
func (b *Block) InitPlain(env environment.Environment, config *Config) {
|
||||
b.ansi = &color.Ansi{}
|
||||
b.ansi.InitPlain(env.Shell())
|
||||
b.ansi.InitPlain()
|
||||
b.writer = &color.AnsiWriter{
|
||||
Ansi: b.ansi,
|
||||
TerminalBackground: shell.ConsoleBackgroundColor(env, config.TerminalBackground),
|
||||
|
|
|
@ -58,7 +58,7 @@ func engineRender() {
|
|||
defer testClearDefaultConfig()
|
||||
|
||||
ansi := &color.Ansi{}
|
||||
ansi.InitPlain(env.Shell())
|
||||
ansi.InitPlain()
|
||||
writerColors := cfg.MakeColors(env)
|
||||
writer := &color.AnsiWriter{
|
||||
Ansi: ansi,
|
||||
|
|
|
@ -3,7 +3,6 @@ package engine
|
|||
import (
|
||||
"io/ioutil"
|
||||
"oh-my-posh/color"
|
||||
"oh-my-posh/shell"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
@ -33,7 +32,7 @@ func runImageTest(config, content string) (string, error) {
|
|||
}
|
||||
defer os.Remove(file.Name())
|
||||
ansi := &color.Ansi{}
|
||||
ansi.InitPlain(shell.PLAIN)
|
||||
ansi.InitPlain()
|
||||
image := &ImageRenderer{
|
||||
AnsiString: content,
|
||||
Ansi: ansi,
|
||||
|
|
Loading…
Reference in a new issue