Repository: JanDeDobbeleer/oh-my-posh
Pull request #6374 (2025-04-18 09:49:16)

feat(aliases): add alias functionality
### Prerequisites

- [x] I have read and understood the [contributing guide][CONTRIBUTING.md].
- [x] The commit message follows the [conventional commits][cc] guidelines.
- [x] Tests for the changes have been added (for bug fixes / features).
- [x] Docs have been added/updated (for bug fixes / features).

<!---

Tips:

If you're not comfortable with working with Git,
we're working a guide (https://ohmyposh.dev/docs/contributing/git) to help you out.
Oh My Posh advises GitKraken (https://www.gitkraken.com/invite/nQmDPR9D) as your preferred cross platform Git GUI power tool.

-->

[CONTRIBUTING.md]: https://github.com/JanDeDobbeleer/oh-my-posh/blob/main/CONTRIBUTING.md
[cc]: https://www.conventionalcommits.org/en/v1.0.0/#summary



Patch:
diff --git a/src/cli/config_export_image.go b/src/cli/config_export_image.go
index 5150ffb7..d7233c2b 100644
--- a/src/cli/config_export_image.go
+++ b/src/cli/config_export_image.go
@@ -62,7 +62,7 @@ Exports the config to an image file using customized output options.`,
 		env := &runtime.Terminal{}
 		env.Init(flags)
 
-		template.Init(env, cfg.Var)
+		template.Init(env, cfg.Var, cfg.Maps)
 
 		defer func() {
 			template.SaveCache()
diff --git a/src/cli/debug.go b/src/cli/debug.go
index d1fe41d9..1c65c16b 100644
--- a/src/cli/debug.go
+++ b/src/cli/debug.go
@@ -51,7 +51,7 @@ func createDebugCmd() *cobra.Command {
 			env := &runtime.Terminal{}
 			env.Init(flags)
 
-			template.Init(env, cfg.Var)
+			template.Init(env, cfg.Var, cfg.Maps)
 
 			defer func() {
 				template.SaveCache()
diff --git a/src/cli/init.go b/src/cli/init.go
index d52b0461..5f287c92 100644
--- a/src/cli/init.go
+++ b/src/cli/init.go
@@ -89,7 +89,7 @@ func runInit(sh string) {
 	env := &runtime.Terminal{}
 	env.Init(flags)
 
-	template.Init(env, cfg.Var)
+	template.Init(env, cfg.Var, cfg.Maps)
 
 	defer func() {
 		template.SaveCache()
diff --git a/src/config/config.go b/src/config/config.go
index a114b49d..46fda7cd 100644
--- a/src/config/config.go
+++ b/src/config/config.go
@@ -5,6 +5,7 @@ import (
 
 	"github.com/jandedobbeleer/oh-my-posh/src/color"
 	"github.com/jandedobbeleer/oh-my-posh/src/log"
+	"github.com/jandedobbeleer/oh-my-posh/src/maps"
 	"github.com/jandedobbeleer/oh-my-posh/src/runtime"
 	"github.com/jandedobbeleer/oh-my-posh/src/segments"
 	"github.com/jandedobbeleer/oh-my-posh/src/shell"
@@ -34,18 +35,19 @@ type Config struct {
 	SecondaryPrompt         *Segment        `json:"secondary_prompt,omitempty" toml:"secondary_prompt,omitempty" yaml:"secondary_prompt,omitempty"`
 	TransientPrompt         *Segment        `json:"transient_prompt,omitempty" toml:"transient_prompt,omitempty" yaml:"transient_prompt,omitempty"`
 	ErrorLine               *Segment        `json:"error_line,omitempty" toml:"error_line,omitempty" yaml:"error_line,omitempty"`
-	TerminalBackground      color.Ansi      `json:"terminal_background,omitempty" toml:"terminal_background,omitempty" yaml:"terminal_background,omitempty"`
+	Maps                    *maps.Config    `json:"maps,omitempty" toml:"maps,omitempty" yaml:"maps,omitempty"`
+	Upgrade                 *upgrade.Config `json:"upgrade,omitempty" toml:"upgrade,omitempty" yaml:"upgrade,omitempty"`
+	Format                  string          `json:"-" toml:"-" yaml:"-"`
+	AccentColor             color.Ansi      `json:"accent_color,omitempty" toml:"accent_color,omitempty" yaml:"accent_color,omitempty"`
+	Output                  string          `json:"-" toml:"-" yaml:"-"`
+	ConsoleTitleTemplate    string          `json:"console_title_template,omitempty" toml:"console_title_template,omitempty" yaml:"console_title_template,omitempty"`
+	PWD                     string          `json:"pwd,omitempty" toml:"pwd,omitempty" yaml:"pwd,omitempty"`
 	origin                  string
-	PWD                     string                 `json:"pwd,omitempty" toml:"pwd,omitempty" yaml:"pwd,omitempty"`
-	AccentColor             color.Ansi             `json:"accent_color,omitempty" toml:"accent_color,omitempty" yaml:"accent_color,omitempty"`
-	Output                  string                 `json:"-" toml:"-" yaml:"-"`
-	ConsoleTitleTemplate    string                 `json:"console_title_template,omitempty" toml:"console_title_template,omitempty" yaml:"console_title_template,omitempty"`
-	Format                  string                 `json:"-" toml:"-" yaml:"-"`
-	Upgrade                 *upgrade.Config        `json:"upgrade,omitempty" toml:"upgrade,omitempty" yaml:"upgrade,omitempty"`
-	Cycle                   color.Cycle            `json:"cycle,omitempty" toml:"cycle,omitempty" yaml:"cycle,omitempty"`
-	ITermFeatures           terminal.ITermFeatures `json:"iterm_features,omitempty" toml:"iterm_features,omitempty" yaml:"iterm_features,omitempty"`
-	Blocks                  []*Block               `json:"blocks,omitempty" toml:"blocks,omitempty" yaml:"blocks,omitempty"`
+	TerminalBackground      color.Ansi             `json:"terminal_background,omitempty" toml:"terminal_background,omitempty" yaml:"terminal_background,omitempty"`
 	Tooltips                []*Segment             `json:"tooltips,omitempty" toml:"tooltips,omitempty" yaml:"tooltips,omitempty"`
+	Blocks                  []*Block               `json:"blocks,omitempty" toml:"blocks,omitempty" yaml:"blocks,omitempty"`
+	ITermFeatures           terminal.ITermFeatures `json:"iterm_features,omitempty" toml:"iterm_features,omitempty" yaml:"iterm_features,omitempty"`
+	Cycle                   color.Cycle            `json:"cycle,omitempty" toml:"cycle,omitempty" yaml:"cycle,omitempty"`
 	Version                 int                    `json:"version" toml:"version" yaml:"version"`
 	AutoUpgrade             bool                   `json:"-" toml:"-" yaml:"-"`
 	ShellIntegration        bool                   `json:"shell_integration,omitempty" toml:"shell_integration,omitempty" yaml:"shell_integration,omitempty"`
diff --git a/src/maps/config.go b/src/maps/config.go
new file mode 100644
index 00000000..5e6e6255
--- /dev/null
+++ b/src/maps/config.go
@@ -0,0 +1,45 @@
+package maps
+
+type Config struct {
+	UserName  *Map `json:"user_name,omitempty" toml:"user_name,omitempty" yaml:"user_name,omitempty"`
+	HostName  *Map `json:"host_name,omitempty" toml:"host_name,omitempty" yaml:"host_name,omitempty"`
+	ShellName *Map `json:"shell_name,omitempty" toml:"shell_name,omitempty" yaml:"shell_name,omitempty"`
+}
+
+func (c *Config) GetUserName(key string) string {
+	if c == nil || c.UserName == nil {
+		return key
+	}
+
+	return c.UserName.Get(key)
+}
+
+func (c *Config) GetHostName(key string) string {
+	if c == nil || c.HostName == nil {
+		return key
+	}
+
+	return c.HostName.Get(key)
+}
+
+func (c *Config) GetShellName(key string) string {
+	if c == nil || c.ShellName == nil {
+		return key
+	}
+
+	return c.ShellName.Get(key)
+}
+
+type Map map[string]string
+
+func (m *Map) Get(key string) string {
+	if m == nil {
+		return key
+	}
+
+	if value, ok := (*m)[key]; ok {
+		return value
+	}
+
+	return key
+}
diff --git a/src/prompt/engine.go b/src/prompt/engine.go
index 8e376fbf..7563ac16 100644
--- a/src/prompt/engine.go
+++ b/src/prompt/engine.go
@@ -486,7 +486,7 @@ func New(flags *runtime.Flags) *Engine {
 	env := &runtime.Terminal{}
 	env.Init(flags)
 
-	template.Init(env, cfg.Var)
+	template.Init(env, cfg.Var, cfg.Maps)
 
 	flags.HasExtra = cfg.DebugPrompt != nil ||
 		cfg.SecondaryPrompt != nil ||
diff --git a/src/segments/session.go b/src/segments/session.go
index 03f2839f..93050d00 100644
--- a/src/segments/session.go
+++ b/src/segments/session.go
@@ -8,8 +8,7 @@ import (
 type Session struct {
 	base
 
-	DefaultUserName string
-	SSHSession      bool
+	SSHSession bool
 }
 
 func (s *Session) Enabled() bool {
diff --git a/src/template/cache.go b/src/template/cache.go
index 0d57846d..5af0b4a2 100644
--- a/src/template/cache.go
+++ b/src/template/cache.go
@@ -18,7 +18,7 @@ var (
 	Cache *cache.Template
 )
 
-func loadCache(vars maps.Simple) {
+func loadCache(vars maps.Simple, aliases *maps.Config) {
 	if !env.Flags().IsPrimary {
 		// Load the template cache for a non-primary prompt before rendering any templates.
 		if OK := restoreCache(env); OK {
@@ -29,7 +29,7 @@ func loadCache(vars maps.Simple) {
 	Cache = new(cache.Template)
 
 	Cache.Root = env.Root()
-	Cache.Shell = env.Shell()
+	Cache.Shell = aliases.GetShellName(env.Shell())
 	Cache.ShellVersion = env.Flags().ShellVersion
 	Cache.Code, _ = env.StatusCodes()
 	Cache.WSL = env.IsWsl()
@@ -59,9 +59,9 @@ func loadCache(vars maps.Simple) {
 		Cache.Folder += `\`
 	}
 
-	Cache.UserName = env.User()
+	Cache.UserName = aliases.GetUserName(env.User())
 	if host, err := env.Host(); err == nil {
-		Cache.HostName = host
+		Cache.HostName = aliases.GetHostName(host)
 	}
 
 	goos := env.GOOS()
diff --git a/src/template/init.go b/src/template/init.go
index e0e8c917..3911af48 100644
--- a/src/template/init.go
+++ b/src/template/init.go
@@ -24,7 +24,7 @@ var (
 	knownFields sync.Map
 )
 
-func Init(environment runtime.Environment, vars maps.Simple) {
+func Init(environment runtime.Environment, vars maps.Simple, aliases *maps.Config) {
 	env = environment
 	shell = env.Shell()
 	knownFields = sync.Map{}
@@ -39,5 +39,5 @@ func Init(environment runtime.Environment, vars maps.Simple) {
 		return
 	}
 
-	loadCache(vars)
+	loadCache(vars, aliases)
 }
diff --git a/themes/schema.json b/themes/schema.json
index 901c5fda..57da8d95 100644
--- a/themes/schema.json
+++ b/themes/schema.json
@@ -140,6 +140,12 @@
       "title": "Filler",
       "description": "Right aligned filler text, will span the remaining width."
     },
+    "alias": {
+      "type": "object",
+      "title": "Aliases",
+      "description": "Custom value replacement for template parts",
+      "default": {}
+    },
     "extra_prompt": {
       "type": "object",
       "default": {},
@@ -514,7 +520,8 @@
           }
         }
       },
-      "allOf": [{
+      "allOf": [
+        {
           "if": {
             "properties": {
               "type": {
@@ -1535,7 +1542,22 @@
           },
           "then": {
             "title": "Docker Segment",
-            "description": "https://ohmyposh.dev/docs/segments/cli/docker"
+            "description": "https://ohmyposh.dev/docs/segments/cli/docker",
+            "properties": {
+              "properties": {
+                "properties": {
+                  "fetch_context": {
+                    "type": "boolean",
+                    "title": "Fetch Context",
+                    "description": "Fetch the Docker context",
+                    "default": true
+                  },
+                  "display_mode": {
+                    "$ref": "#/definitions/display_mode"
+                  }
+                }
+              }
+            }
           }
         },
         {
@@ -5104,7 +5126,8 @@
               }
             }
           }
-        }]
+        }
+      ]
     }
   },
   "required": [
@@ -5323,6 +5346,25 @@
       "title": "Config variables to use in templates (can be any value)",
       "description": "https://ohmyposh.dev/docs/configuration/templates#config-variables",
       "default": {}
+    },
+    "aliases": {
+      "type": "object",
+      "title": "Aliases",
+      "description": "https://ohmyposh.dev/docs/configuration/aliases",
+      "default": {},
+      "items": {
+        "properties": {
+          "user_name": {
+            "$ref": "#/definitions/alias"
+          },
+          "host_name": {
+            "$ref": "#/definitions/alias"
+          },
+          "shell_name": {
+            "$ref": "#/definitions/alias"
+          }
+        }
+      }
     }
   }
 }
diff --git a/website/docs/configuration/general.mdx b/website/docs/configuration/general.mdx
index 6b688dee..4b343018 100644
--- a/website/docs/configuration/general.mdx
+++ b/website/docs/configuration/general.mdx
@@ -136,8 +136,33 @@ For example, the following is a valid `--config` flag:
 | `shell_integration`         | `boolean`        | `false` | enable shell integration using FinalTerm's OSC sequences. Works in bash, cmd (Clink v1.14.25+), fish, powershell and zsh                                                                                                                                                     |
 | `enable_cursor_positioning` | `boolean`        | `false` | enable fetching the cursor position in bash and zsh to allow automatic hiding of leading newlines when at the top of the shell                                                                                                                                               |
 | `patch_pwsh_bleed`          | `boolean`        | `false` | patch a PowerShell bug where the background colors bleed into the next line at the end of the buffer (can be removed when [this][pwsh-bleed] is merged)                                                                                                                      |
-| `upgrade`                   | `Upgrade`        |         | enable auto upgrade or the upgrade notice. See [Upgrade]                                                                                                                                                                                            |
+| `upgrade`                   | `Upgrade`        |         | enable auto upgrade or the upgrade notice. See [Upgrade]                                                                                                                                                                                                                     |
 | `iterm_features`            | `[]string`       | `false` | enable iTerm2 specific features:<ul><li>`prompt_mark`: add the `iterm2_prompt_mark` [function][iterm2-si] for supported shells</li><li>`current_dir`: expose the current directory for iTerm2</li><li>`remote_host`: expose the current remote and user for iTerm2</li></ul> |
+| `maps`                      | [`Maps`](#maps)  |         | a list of custom text mappings                                                                                                                                                                                                                                               |
+
+### Maps
+
+| Name         | Type     | Description                              |
+| ------------ | -------- | ---------------------------------------- |
+| `user_name`  | `object` | text replacement mapping for user names  |
+| `host_name`  | `object` | text replacement mapping for host names  |
+| `shell_name` | `object` | text replacement mapping for shell names |
+
+import Config from "@site/src/components/Config.js";
+
+<Config
+  data={{
+    maps: {
+      user_name: {
+        jan: "🚀",
+        root: "⚡",
+      },
+      host_name: {
+        laptop123: "work",
+      },
+    },
+  }}
+/>
 
 ### JSON Schema Validation
 


Test patch:
diff --git a/src/color/colors_test.go b/src/color/colors_test.go
index 61ef9d58..415127e4 100644
--- a/src/color/colors_test.go
+++ b/src/color/colors_test.go
@@ -81,7 +81,7 @@ func TestAnsiRender(t *testing.T) {
 		env.On("Shell").Return("foo")
 
 		template.Cache = new(cache.Template)
-		template.Init(env, nil)
+		template.Init(env, nil, nil)
 
 		ansi := Ansi("{{ if eq \"vscode\" .Env.TERM_PROGRAM }}#123456{{end}}")
 		got := ansi.ResolveTemplate()
diff --git a/src/config/config_test.go b/src/config/config_test.go
index abdbb6e7..6a84c9d4 100644
--- a/src/config/config_test.go
+++ b/src/config/config_test.go
@@ -100,7 +100,7 @@ func TestGetPalette(t *testing.T) {
 		template.Cache = &cache.Template{
 			Shell: "bash",
 		}
-		template.Init(env, nil)
+		template.Init(env, nil, nil)
 
 		cfg := &Config{
 			Palette:  tc.Palette,
diff --git a/src/prompt/engine_test.go b/src/prompt/engine_test.go
index a16e41f8..fd5d5357 100644
--- a/src/prompt/engine_test.go
+++ b/src/prompt/engine_test.go
@@ -98,7 +98,7 @@ func TestPrintPWD(t *testing.T) {
 			Shell:    tc.Shell,
 			Segments: maps.NewConcurrent(),
 		}
-		template.Init(env, nil)
+		template.Init(env, nil, nil)
 
 		terminal.Init(shell.GENERIC)
 
@@ -133,7 +133,7 @@ func engineRender() {
 	template.Cache = &cache.Template{
 		Segments: maps.NewConcurrent(),
 	}
-	template.Init(env, nil)
+	template.Init(env, nil, nil)
 
 	terminal.Init(shell.GENERIC)
 	terminal.BackgroundColor = cfg.TerminalBackground.ResolveTemplate()
@@ -201,7 +201,7 @@ func TestGetTitle(t *testing.T) {
 			Folder:   "vagrant",
 			Segments: maps.NewConcurrent(),
 		}
-		template.Init(env, nil)
+		template.Init(env, nil, nil)
 
 		engine := &Engine{
 			Config: &config.Config{
@@ -263,7 +263,7 @@ func TestGetConsoleTitleIfGethostnameReturnsError(t *testing.T) {
 			HostName: "",
 			Segments: maps.NewConcurrent(),
 		}
-		template.Init(env, nil)
+		template.Init(env, nil, nil)
 
 		engine := &Engine{
 			Config: &config.Config{
@@ -375,7 +375,7 @@ func TestShouldFill(t *testing.T) {
 			Shell:    shell.GENERIC,
 			Segments: maps.NewConcurrent(),
 		}
-		template.Init(env, nil)
+		template.Init(env, nil, nil)
 
 		terminal.Init(shell.GENERIC)
 		terminal.Plain = true
diff --git a/src/segments/path_test.go b/src/segments/path_test.go
index c2050c8e..2dac182e 100644
--- a/src/segments/path_test.go
+++ b/src/segments/path_test.go
@@ -30,7 +30,7 @@ func renderTemplateNoTrimSpace(env *mock.Environment, segmentTemplate string, co
 	if template.Cache == nil {
 		template.Cache = &cache.Template{}
 	}
-	template.Init(env, nil)
+	template.Init(env, nil, nil)
 
 	tmpl := &template.Text{
 		Template: segmentTemplate,
@@ -243,7 +243,7 @@ func TestFullPathCustomMappedLocations(t *testing.T) {
 		env.On("Getenv", "HOME").Return(homeDir)
 
 		template.Cache = new(cache.Template)
-		template.Init(env, nil)
+		template.Init(env, nil, nil)
 
 		props := properties.Map{
 			properties.Style:       Full,
@@ -365,7 +365,7 @@ func TestGetFolderSeparator(t *testing.T) {
 		template.Cache = &cache.Template{
 			Shell: "bash",
 		}
-		template.Init(env, nil)
+		template.Init(env, nil, nil)
 
 		props := properties.Map{}
 
@@ -484,7 +484,7 @@ func TestGetMaxWidth(t *testing.T) {
 		env.On("Shell").Return(shell.BASH)
 
 		template.Cache = new(cache.Template)
-		template.Init(env, nil)
+		template.Init(env, nil, nil)
 
 		props := properties.Map{
 			MaxWidth: tc.MaxWidth,
diff --git a/src/segments/path_unix_test.go b/src/segments/path_unix_test.go
index c5817402..de064d56 100644
--- a/src/segments/path_unix_test.go
+++ b/src/segments/path_unix_test.go
@@ -707,7 +707,7 @@ func TestFolderPathCustomMappedLocations(t *testing.T) {
 	env.On("Shell").Return(shell.GENERIC)
 
 	template.Cache = new(cache.Template)
-	template.Init(env, nil)
+	template.Init(env, nil, nil)
 
 	props := properties.Map{
 		properties.Style: FolderType,
@@ -753,7 +753,7 @@ func TestReplaceMappedLocations(t *testing.T) {
 		env.On("Home").Return("/a/b/k")
 
 		template.Cache = new(cache.Template)
-		template.Init(env, nil)
+		template.Init(env, nil, nil)
 
 		props := properties.Map{
 			MappedLocationsEnabled: tc.MappedLocationsEnabled,
@@ -813,7 +813,7 @@ func TestGetPwd(t *testing.T) {
 		env.On("Shell").Return(shell.PWSH)
 
 		template.Cache = new(cache.Template)
-		template.Init(env, nil)
+		template.Init(env, nil, nil)
 
 		props := properties.Map{
 			MappedLocationsEnabled: tc.MappedLocationsEnabled,
diff --git a/src/segments/scm_test.go b/src/segments/scm_test.go
index 9b4300f7..8514e63c 100644
--- a/src/segments/scm_test.go
+++ b/src/segments/scm_test.go
@@ -222,7 +222,7 @@ func TestFormatBranch(t *testing.T) {
 		env := new(mock.Environment)
 		env.On("Shell").Return(shell.BASH)
 		template.Cache = new(cache.Template)
-		template.Init(env, nil)
+		template.Init(env, nil, nil)
 
 		got := g.formatBranch(tc.Input)
 		assert.Equal(t, tc.Expected, got, tc.Case)
diff --git a/src/segments/session_test.go b/src/segments/session_test.go
index 3e8d81fb..d67d67da 100644
--- a/src/segments/session_test.go
+++ b/src/segments/session_test.go
@@ -15,16 +15,15 @@ import (
 
 func TestSessionSegmentTemplate(t *testing.T) {
 	cases := []struct {
-		Case            string
-		ExpectedString  string
-		UserName        string
-		DefaultUserName string
-		ComputerName    string
-		Template        string
-		WhoAmI          string
-		Platform        string
-		SSHSession      bool
-		Root            bool
+		Case           string
+		ExpectedString string
+		UserName       string
+		ComputerName   string
+		Template       string
+		WhoAmI         string
+		Platform       string
+		SSHSession     bool
+		Root           bool
 	}{
 		{
 			Case:           "user and computer",
@@ -72,26 +71,6 @@ func TestSessionSegmentTemplate(t *testing.T) {
 			ComputerName:   "remote",
 			Root:           true,
 		},
-		{
-			Case:            "default user not equal",
-			ExpectedString:  "john",
-			UserName:        "john",
-			DefaultUserName: "jack",
-			SSHSession:      true,
-			ComputerName:    "remote",
-			Root:            true,
-			Template:        "{{if ne .Env.POSH_SESSION_DEFAULT_USER .UserName}}{{.UserName}}{{end}}",
-		},
-		{
-			Case:            "default user equal",
-			ExpectedString:  "",
-			UserName:        "john",
-			DefaultUserName: "john",
-			SSHSession:      true,
-			ComputerName:    "remote",
-			Root:            true,
-			Template:        "{{if ne .Env.POSH_SESSION_DEFAULT_USER .UserName}}{{.UserName}}{{end}}",
-		},
 		{
 			Case:           "user with ssh using who am i",
 			ExpectedString: "john on remote",
@@ -126,7 +105,6 @@ func TestSessionSegmentTemplate(t *testing.T) {
 
 		env.On("Getenv", "SSH_CONNECTION").Return(SSHSession)
 		env.On("Getenv", "SSH_CLIENT").Return(SSHSession)
-		env.On("Getenv", "POSH_SESSION_DEFAULT_USER").Return(tc.DefaultUserName)
 
 		env.On("Platform").Return(tc.Platform)
 
diff --git a/src/segments/status_test.go b/src/segments/status_test.go
index b85f2fd8..3cd9affd 100644
--- a/src/segments/status_test.go
+++ b/src/segments/status_test.go
@@ -37,7 +37,7 @@ func TestStatusWriterEnabled(t *testing.T) {
 		template.Cache = &cache.Template{
 			Code: 133,
 		}
-		template.Init(env, nil)
+		template.Init(env, nil, nil)
 
 		s := &Status{}
 		s.Init(props, env)
diff --git a/src/segments/ui5tooling_test.go b/src/segments/ui5tooling_test.go
index 6bc2b81f..9abe88df 100644
--- a/src/segments/ui5tooling_test.go
+++ b/src/segments/ui5tooling_test.go
@@ -95,7 +95,7 @@ func TestUI5Tooling(t *testing.T) {
 		// this is needed to build the version URL as before renderTemplate, the template is not initialized
 		env.On("Shell").Return("foo")
 		template.Cache = &cache.Template{}
-		template.Init(env, nil)
+		template.Init(env, nil, nil)
 
 		failMsg := fmt.Sprintf("Failed in case: %s", tc.Case)
 		assert.True(t, ui5tooling.Enabled(), failMsg)
diff --git a/src/template/files_test.go b/src/template/files_test.go
index b8f86238..3d101f7f 100644
--- a/src/template/files_test.go
+++ b/src/template/files_test.go
@@ -25,7 +25,7 @@ func TestGlob(t *testing.T) {
 	env.On("Shell").Return("foo")
 
 	Cache = new(cache.Template)
-	Init(env, nil)
+	Init(env, nil, nil)
 
 	for _, tc := range cases {
 		tmpl := &Text{
diff --git a/src/template/link_test.go b/src/template/link_test.go
index 136755d3..652f0209 100644
--- a/src/template/link_test.go
+++ b/src/template/link_test.go
@@ -25,7 +25,7 @@ func TestUrl(t *testing.T) {
 
 	Cache = new(cache.Template)
 
-	Init(env, nil)
+	Init(env, nil, nil)
 
 	for _, tc := range cases {
 		tmpl := &Text{
diff --git a/src/template/text_test.go b/src/template/text_test.go
index b3679757..8668c955 100644
--- a/src/template/text_test.go
+++ b/src/template/text_test.go
@@ -165,7 +165,7 @@ func TestRenderTemplate(t *testing.T) {
 		env := new(mock.Environment)
 		env.On("Shell").Return("foo")
 		Cache = new(cache.Template)
-		Init(env, nil)
+		Init(env, nil, nil)
 
 		text, err := tmpl.Render()
 		if tc.ShouldError {
@@ -251,7 +251,7 @@ func TestRenderTemplateEnvVar(t *testing.T) {
 		Cache = &cache.Template{
 			OS: "darwin",
 		}
-		Init(env, nil)
+		Init(env, nil, nil)
 
 		tmpl := &Text{
 			Template: tc.Template,
@@ -344,7 +344,7 @@ func TestPatchTemplate(t *testing.T) {
 	env := new(mock.Environment)
 	env.On("Shell").Return("foo")
 	Cache = new(cache.Template)
-	Init(env, nil)
+	Init(env, nil, nil)
 
 	for _, tc := range cases {
 		tmpl := &Text{
@@ -374,7 +374,7 @@ func TestPatchTemplateStruct(t *testing.T) {
 	env := new(mock.Environment)
 	env.On("Shell").Return("foo")
 	Cache = new(cache.Template)
-	Init(env, nil)
+	Init(env, nil, nil)
 
 	tmpl := &Text{
 		Template: "{{ .Hello }}",
@@ -403,7 +403,7 @@ func TestSegmentContains(t *testing.T) {
 	Cache = &cache.Template{
 		Segments: segments,
 	}
-	Init(env, nil)
+	Init(env, nil, nil)
 
 	for _, tc := range cases {
 		tmpl := &Text{