refactor(session): deprecate ssh_icon

This commit is contained in:
Jan De Dobbeleer 2021-12-04 10:22:38 +01:00 committed by Jan De Dobbeleer
parent f3f2985543
commit 39a27b29ad
3 changed files with 4 additions and 8 deletions

View file

@ -19,15 +19,13 @@ Show the current user and host name.
"leading_diamond": "\uE0B6",
"trailing_diamond": "\uE0B0",
"properties": {
"template": "{{ .UserName }}"
"template": "{{ if .SSHSession }}\uF817 {{ end }}{{ .UserName }}"
}
}
```
## Properties
- ssh_icon: `string` - text/icon to display first when in an active SSH session - defaults
to `\uF817 `
- template: `string` - A go [text/template][go-text-template] template extended with [sprig][sprig] utilizing the
properties below.

View file

@ -254,6 +254,8 @@ const (
DisplayUser Property = "display_user"
// DefaultUserName holds the default user of the platform
DefaultUserName Property = "default_user_name"
// SSHIcon is the icon used for SSH sessions
SSHIcon Property = "ssh_icon"
defaultUserEnvVar = "POSH_SESSION_DEFAULT_USER"
)

View file

@ -12,14 +12,10 @@ type session struct {
SSHSession bool
Root bool
// Deprecated
DefaultUserName string
}
const (
// SSHIcon is the icon used for SSH sessions
SSHIcon Property = "ssh_icon"
)
func (s *session) enabled() bool {
s.SSHSession = s.activeSSHSession()
segmentTemplate := s.props.getString(SegmentTemplate, "")