跳到主要内容

Claude Cage · 面向 Claude 的隔离开发环境,支持桌面工作台、多账号、远程部署与移动端连接。上游 Lee-xeo/Claude-Cage 完整源码镜像,非灵栈原创;主许可 MIT,第三方组件遵循各自许可。来源:https://github.com/Lee-xeo/Claude-Cage 。手动同步,不附带 Release 安装包。

浏览文件

08-shell-prompt.sh

46 行 · 1.5 KB历史下载
1#!/bin/sh
2
3# SPDX-FileCopyrightText: Copyright The Lima Authors
4# SPDX-License-Identifier: Apache-2.0
5
6set -eux
7
8# This script is only intended for the default.yaml image, which is based on Ubuntu LTS
9
10if [ "${LIMA_CIDATA_NAME}" = "default" ] && command -v patch >/dev/null 2>&1 && grep -q color_prompt "${LIMA_CIDATA_HOME}/.bashrc"; then
11
12 ! grep -q "^# Lima PS1" "${LIMA_CIDATA_HOME}/.bashrc" || exit 0
13
14 # Change the default shell prompt from "green" to "lime green" (#32CD32)
15
16 patch --forward -r - "${LIMA_CIDATA_HOME}/.bashrc" <<'EOF'
17@@ -37,7 +37,11 @@
18
19 # set a fancy prompt (non-color, unless we know we "want" color)
20 case "$TERM" in
21- xterm-color|*-256color) color_prompt=yes;;
22+ xterm-color) color_prompt=yes;;
23+ *-256color) color_prompt=256;;
24+esac
25+case "$COLORTERM" in
26+ truecolor) color_prompt=true;;
27 esac
28
29 # uncomment for a colored prompt, if the terminal has the capability; turned
30@@ -56,7 +60,12 @@
31 fi
32 fi
33
34-if [ "$color_prompt" = yes ]; then
35+# Lima PS1: set color to lime green
36+if [ "$color_prompt" = true ]; then
37+ PS1='${debian_chroot:+($debian_chroot)}\[\033[38;2;50;205;50m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
38+elif [ "$color_prompt" = 256 ]; then
39+ PS1='${debian_chroot:+($debian_chroot)}\[\033[38;5;77m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
40+elif [ "$color_prompt" = yes ]; then
41 PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
42 else
43 PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
44EOF
45
46fi