From 39a27b29adeb95176ef973b167f57b4733b3407f Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Sat, 4 Dec 2021 10:22:38 +0100 Subject: [PATCH] refactor(session): deprecate ssh_icon --- docs/docs/segment-session.md | 4 +--- src/segment_deprecated.go | 2 ++ src/segment_session.go | 6 +----- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/docs/docs/segment-session.md b/docs/docs/segment-session.md index 53ffee6c..f0067415 100644 --- a/docs/docs/segment-session.md +++ b/docs/docs/segment-session.md @@ -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. diff --git a/src/segment_deprecated.go b/src/segment_deprecated.go index 8dd728aa..faf2dc8f 100644 --- a/src/segment_deprecated.go +++ b/src/segment_deprecated.go @@ -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" ) diff --git a/src/segment_session.go b/src/segment_session.go index 4bfe754a..06ab4f76 100644 --- a/src/segment_session.go +++ b/src/segment_session.go @@ -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, "")