diff --git a/website/docs/terminal/terminal.md b/website/docs/terminal/terminal.md deleted file mode 100644 index d32cd7e2..00000000 --- a/website/docs/terminal/terminal.md +++ /dev/null @@ -1,41 +0,0 @@ -# Terminal Customizations - -If you use **Busly CLI** often, you may want to customize your terminal to always display the currently configured transport. This is especially helpful to quickly know whether youโ€™re pointing to your local or a non-production environment. - -Below is an example configuration using **Oh My Posh** to display the current transport in your prompt: - -![Busly Oh My Posh Custom Segment](../../static/gifs/terminal-customization-oh-my-posh.gif) - ---- - -## Oh My Posh Custom Segment - -Assuming **Oh My Posh** is installed and configured for your shell, you can extend your theme by adding a **command segment** that invokes `busly transport current`: - -```json -{ - "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json", - "blocks": [ - { - "type": "prompt", - "alignment": "left", - "segments": [ - // ... your existing segments ... - { - "type": "command", - "style": "powerline", - "powerline_symbol": "\ue0b0", - "background": "#4e9a06", - "foreground": "#000000", - "properties": { - "shell": "cmd", - "command": "/c busly transport current" - }, - "template": "๐ŸšŒ {{ .Output }}" - } - ] - } - ], - "final_space": true -} -``` diff --git a/website/docs/terminal/terminal.mdx b/website/docs/terminal/terminal.mdx new file mode 100644 index 00000000..cd05cd8c --- /dev/null +++ b/website/docs/terminal/terminal.mdx @@ -0,0 +1,116 @@ +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + +# Terminal Customizations + +If you use **Busly CLI** often, you may want to customize your terminal to always display the currently configured transport and/or service control instance. This is especially helpful to quickly know whether you're pointing to your local or a non-production environment. + +![Busly Oh My Posh Custom Segment](../../static/gifs/terminal-customization-oh-my-posh.gif) + +## Oh My Posh + +Assuming **Oh My Posh** is installed and configured for your shell, you can extend your theme to display the current transport and service control instance in your prompt. + +### Shell Profile + +Add the following to your shell profile so that Oh My Posh can populate the environment variables used by the theme segments below: + + + + +Add to the bottom of your PowerShell profile (`$PROFILE`): + +```powershell +function Set-EnvVar([bool]$originalStatus) { + $env:POSH_BUSLY_TRANSPORT_CURRENT=$(busly transport current) + $env:POSH_BUSLY_SERVICECONTROL_INSTANCE_CURRENT=$(busly servicecontrol instance current) +} +New-Alias -Name 'Set-PoshContext' -Value 'Set-EnvVar' -Scope Global -Force +``` + + + + +Add to the bottom of your `~/.zshrc`: + +```bash +function set_poshcontext() { + export POSH_BUSLY_TRANSPORT_CURRENT=$(busly transport current) + export POSH_BUSLY_SERVICECONTROL_INSTANCE_CURRENT=$(busly servicecontrol instance current) +} +``` + + + + +Add to the bottom of your `~/.bashrc`: + +```bash +function set_poshcontext() { + export POSH_BUSLY_TRANSPORT_CURRENT=$(busly transport current) + export POSH_BUSLY_SERVICECONTROL_INSTANCE_CURRENT=$(busly servicecontrol instance current) +} +``` + + + + +Add to the bottom of your `~/.config/fish/config.fish`: + +```shell +function set_poshcontext + set --export POSH_BUSLY_TRANSPORT_CURRENT $(busly transport current) + set --export POSH_BUSLY_SERVICECONTROL_INSTANCE_CURRENT $(busly servicecontrol instance current) +end +``` + + + + +Add to the bottom of your Nushell `env.nu`: + +```bash +$env.SET_POSHCONTEXT = { + $env.POSH_BUSLY_TRANSPORT_CURRENT = (busly transport current); + $env.POSH_BUSLY_SERVICECONTROL_INSTANCE_CURRENT = (busly servicecontrol instance current); +} +``` + + + + +### Theme Configuration + +Add the following segments to your Oh My Posh theme JSON: + +```json +{ + "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json", + "blocks": [ + { + "type": "prompt", + "alignment": "left", + "segments": [ + // ... your existing segments ... + { + "type": "text", + "style": "powerline", + "powerline_symbol": "\ue0b0", + "background": "#4e9a06", + "foreground": "#000000", + "template": "๐ŸšŒ {{ .Env.POSH_BUSLY_TRANSPORT_CURRENT }}" + }, + { + "type": "text", + "style": "powerline", + "powerline_symbol": "\ue0b0", + "background": "#3465a4", + "foreground": "#ffffff", + "template": "\uf233 {{ .Env.POSH_BUSLY_SERVICECONTROL_INSTANCE_CURRENT }}" + }, + ] + } + ], + "final_space": true +} +``` diff --git a/website/static/gifs/terminal-customization-oh-my-posh.gif b/website/static/gifs/terminal-customization-oh-my-posh.gif index 7c4c1222..30fc0df9 100644 Binary files a/website/static/gifs/terminal-customization-oh-my-posh.gif and b/website/static/gifs/terminal-customization-oh-my-posh.gif differ