mirror of
https://github.com/getcompanion-ai/computer-guest.git
synced 2026-04-15 09:01:12 +00:00
feat: update pure prompt zsh naming nad other guest os files (#6)
This commit is contained in:
parent
63b6a452b0
commit
ef8f354291
4 changed files with 63 additions and 5 deletions
|
|
@ -12,8 +12,25 @@ setopt prompt_subst
|
|||
bindkey -v
|
||||
bindkey '^?' backward-delete-char
|
||||
|
||||
computer_prompt_base_name() {
|
||||
local name=""
|
||||
if [ -n "${COMPUTER_NAME:-}" ]; then
|
||||
name="${COMPUTER_NAME}"
|
||||
elif [ -n "${COMPUTER_HANDLE:-}" ]; then
|
||||
name="${COMPUTER_HANDLE}"
|
||||
elif [ -r /etc/microagent/machine-name ]; then
|
||||
IFS= read -r name </etc/microagent/machine-name || true
|
||||
elif [ -r /etc/hostname ]; then
|
||||
IFS= read -r name </etc/hostname || true
|
||||
fi
|
||||
if [ -z "$name" ]; then
|
||||
name="microagentcomputer"
|
||||
fi
|
||||
printf '%s' "$name"
|
||||
}
|
||||
|
||||
computer_prompt_name() {
|
||||
printf '%s' "${COMPUTER_NAME:-${COMPUTER_HANDLE:-microagentcomputer}}"
|
||||
printf '%s(computer)' "$(computer_prompt_base_name)"
|
||||
}
|
||||
|
||||
ZSH_CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/zsh"
|
||||
|
|
@ -50,6 +67,7 @@ if [ -r /opt/zsh/pure/pure.zsh ] && [ -r /opt/zsh/pure/async.zsh ]; then
|
|||
autoload -Uz promptinit
|
||||
promptinit
|
||||
if prompt pure >/dev/null 2>&1; then
|
||||
prompt_pure_context() { :; }
|
||||
zstyle ':prompt:pure:path' color blue
|
||||
pure_prompt="$PROMPT"
|
||||
PROMPT='%F{green}$(computer_prompt_name)%f '"$pure_prompt"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue