Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion config/starship.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
add_newline = true
command_timeout = 200
format = "[$directory$git_branch$git_status]($style)$character"
format = "[$hostname$directory$git_branch$git_status]($style)$character"

[character]
error_symbol = "[✗](bold cyan)"
Expand Down Expand Up @@ -30,3 +30,7 @@ stashed = ""
staged = ""
renamed = ""
deleted = ""

[hostname]
ssh_only = true
format = '[$hostname]($style) '
23 changes: 23 additions & 0 deletions migrations/1780739892.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
echo "Show hostname in Starship over SSH"

starship_config="$HOME/.config/starship.toml"
Comment thread
crmne marked this conversation as resolved.
old_format_pattern='^[[:space:]]*format = "\[\$directory\$git_branch\$git_status\]\(\$style\)\$character"$'

if [[ -f "$starship_config" ]] && grep -Eq "$old_format_pattern" "$starship_config" && ! grep -q '^\[hostname\]' "$starship_config"; then
tmp=$(mktemp)
awk '
/^[[:space:]]*format = "\[\$directory\$git_branch\$git_status\]\(\$style\)\$character"$/ && !updated {
print "format = \"[$hostname$directory$git_branch$git_status]($style)$character\""
updated = 1
next
}
{ print }
' "$starship_config" >"$tmp" && mv "$tmp" "$starship_config"

cat >>"$starship_config" <<'EOF'

[hostname]
ssh_only = true
format = '[$hostname]($style) '
EOF
fi