2020-10-05 02:33:12 -07:00
|
|
|
---
|
|
|
|
id: session
|
|
|
|
title: Session
|
|
|
|
sidebar_label: Session
|
|
|
|
---
|
|
|
|
|
|
|
|
## What
|
|
|
|
|
|
|
|
Show the current user and host name.
|
|
|
|
|
|
|
|
## Sample Configuration
|
|
|
|
|
2023-03-31 11:55:36 -07:00
|
|
|
import Config from '@site/src/components/Config.js';
|
|
|
|
|
|
|
|
<Config data={{
|
2020-10-05 02:33:12 -07:00
|
|
|
"type": "session",
|
2022-01-17 04:16:04 -08:00
|
|
|
"style": "diamond",
|
2020-10-05 02:33:12 -07:00
|
|
|
"foreground": "#ffffff",
|
|
|
|
"background": "#c386f1",
|
2020-10-16 08:12:34 -07:00
|
|
|
"leading_diamond": "\uE0B6",
|
2021-12-03 14:44:58 -08:00
|
|
|
"trailing_diamond": "\uE0B0",
|
2023-05-09 02:08:45 -07:00
|
|
|
"template": "{{ if .SSHSession }}\ueba9 {{ end }}{{ .UserName }}"
|
2023-03-31 11:55:36 -07:00
|
|
|
}}/>
|
2020-10-05 02:33:12 -07:00
|
|
|
|
2022-02-01 03:10:46 -08:00
|
|
|
## Template ([info][templates])
|
|
|
|
|
|
|
|
:::note default template
|
|
|
|
|
2022-09-16 07:32:48 -07:00
|
|
|
```template
|
2023-05-09 02:08:45 -07:00
|
|
|
{{ if .SSHSession }}\ueba9 {{ end }}{{ .UserName }}@{{ .HostName }}
|
2022-02-01 03:10:46 -08:00
|
|
|
```
|
|
|
|
|
|
|
|
:::
|
|
|
|
|
|
|
|
### Properties
|
2021-02-15 03:53:28 -08:00
|
|
|
|
2022-09-16 07:32:48 -07:00
|
|
|
| Name | Type | Description |
|
|
|
|
| ------------- | --------- | -------------------------------- |
|
|
|
|
| `.UserName` | `string` | the current user's name |
|
|
|
|
| `.HostName` | `string` | the current computer's name |
|
|
|
|
| `.SSHSession` | `boolean` | active SSH session or not |
|
|
|
|
| `.Root` | `boolean` | are you a root/admin user or not |
|
2021-02-15 03:53:28 -08:00
|
|
|
|
2022-04-20 09:43:59 -07:00
|
|
|
[templates]: /docs/configuration/templates
|