summaryrefslogtreecommitdiff
path: root/features/src/common-utils/scripts/devcontainers.zsh-theme
diff options
context:
space:
mode:
authorNeonXP <i@neonxp.ru>2024-01-28 20:43:11 +0300
committerNeonXP <i@neonxp.ru>2024-01-28 22:07:35 +0300
commit11412b2e720f754900b39d195f33af39ed11d085 (patch)
tree96d7e561f21809aead3c0f25034f083f46ef064c /features/src/common-utils/scripts/devcontainers.zsh-theme
parent6c00916212073678bbeb3bdde3f121c4efad707a (diff)
Go теперь фича над базовым образомHEADmaster
Diffstat (limited to 'features/src/common-utils/scripts/devcontainers.zsh-theme')
-rw-r--r--features/src/common-utils/scripts/devcontainers.zsh-theme26
1 files changed, 26 insertions, 0 deletions
diff --git a/features/src/common-utils/scripts/devcontainers.zsh-theme b/features/src/common-utils/scripts/devcontainers.zsh-theme
new file mode 100644
index 0000000..ff11c91
--- /dev/null
+++ b/features/src/common-utils/scripts/devcontainers.zsh-theme
@@ -0,0 +1,26 @@
+# Oh My Zsh! theme - partly inspired by https://github.com/ohmyzsh/ohmyzsh/blob/master/themes/robbyrussell.zsh-theme
+__zsh_prompt() {
+ local prompt_username
+ if [ ! -z "${GITHUB_USER}" ]; then
+ prompt_username="@${GITHUB_USER}"
+ else
+ prompt_username="%n"
+ fi
+ PROMPT="%{$fg[green]%}${prompt_username} %(?:%{$reset_color%}➜ :%{$fg_bold[red]%}➜ )" # User/exit code arrow
+ PROMPT+='%{$fg_bold[blue]%}%(5~|%-1~/…/%3~|%4~)%{$reset_color%} ' # cwd
+ PROMPT+='`\
+ if [ "$(git config --get devcontainers-theme.hide-status 2>/dev/null)" != 1 ] && [ "$(git config --get codespaces-theme.hide-status 2>/dev/null)" != 1 ]; then \
+ export BRANCH=$(git --no-optional-locks symbolic-ref --short HEAD 2>/dev/null || git --no-optional-locks rev-parse --short HEAD 2>/dev/null); \
+ if [ "${BRANCH}" != "" ]; then \
+ echo -n "%{$fg_bold[cyan]%}(%{$fg_bold[red]%}${BRANCH}" \
+ && if [ "$(git config --get devcontainers-theme.show-dirty 2>/dev/null)" = 1 ] && \
+ git --no-optional-locks ls-files --error-unmatch -m --directory --no-empty-directory -o --exclude-standard ":/*" > /dev/null 2>&1; then \
+ echo -n " %{$fg_bold[yellow]%}✗"; \
+ fi \
+ && echo -n "%{$fg_bold[cyan]%})%{$reset_color%} "; \
+ fi; \
+ fi`'
+ PROMPT+='%{$fg[white]%}$ %{$reset_color%}'
+ unset -f __zsh_prompt
+}
+__zsh_prompt