From f9f3626b6459f8c66bcf0289e9e105f08c566d06 Mon Sep 17 00:00:00 2001 From: Garth Johnson Date: Tue, 19 Dec 2023 20:28:13 +0000 Subject: [PATCH 01/16] rm duplicates added rsync --- Dockerfile | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 11212cd..fafabd3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,20 +12,16 @@ RUN apt-get -yq update && apt-get -yq install \ # Install apps/tools RUN apt-get -yq install --no-install-recommends \ - mosquitto-clients \ + sudo openssh-client mosquitto-clients \ nano vim less \ - tcpdump traceroute iproute2 dnsutils whois mtr iftop iputils-ping \ - dialog htop \ - netcat-traditional \ - wget nmap \ - zsh git \ - sudo openssh-client \ - tcpdump procps iproute2 \ + zsh git rsync \ + tcpdump traceroute iproute2 dnsutils whois mtr iftop iputils-ping wget nmap netcat-traditional \ + procps \ + htop \ # Clean up && apt-get autoremove -y \ && apt-get clean -y \ - && rm -rf /var/lib/apt/lists/* \ - && apt-get clean + && rm -rf /var/lib/apt/lists/* # ensure that there is a place to mount the host files RUN mkdir /host From a3bd584f081791986161b7f7d2cb4bfc8e63527a Mon Sep 17 00:00:00 2001 From: Garth Johnson Date: Tue, 19 Dec 2023 22:52:05 +0000 Subject: [PATCH 02/16] added bzip, pw10 theme ownership, and consistant ADD over COPY --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index fafabd3..909f4dc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,7 @@ RUN apt-get -yq update && apt-get -yq install \ RUN apt-get -yq install --no-install-recommends \ sudo openssh-client mosquitto-clients \ nano vim less \ - zsh git rsync \ + zsh git rsync bzip2 \ tcpdump traceroute iproute2 dnsutils whois mtr iftop iputils-ping wget nmap netcat-traditional \ procps \ htop \ @@ -50,7 +50,7 @@ USER $USERNAME # Install ZSH, OhMyZSH, themes and plugins ADD src/zsh-in-docker.sh . -COPY src/.p10k.zsh /home/$USERNAME/.p10k.zsh +ADD --chown=1000:1000 src/.p10k.zsh /home/$USERNAME/.p10k.zsh RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" RUN ./zsh-in-docker.sh \ -p git \ @@ -70,7 +70,7 @@ RUN ./zsh-in-docker.sh \ -a 'bindkey "\$terminfo[kcud1]" history-substring-search-down' \ -a '[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh' -COPY src/tasks.py . +ADD src/tasks.py . ADD https://private-sw-downloads.s3.amazonaws.com/archfx_broker/preflight/broker_preflight.sh . From e117678dd225902bb38446fd46d7be1921937282 Mon Sep 17 00:00:00 2001 From: Garth Johnson Date: Wed, 20 Dec 2023 01:24:24 +0000 Subject: [PATCH 03/16] adding ownership and history plugin as well as rc files --- Dockerfile | 12 +++-- src/.p10k.zsh | 6 +-- src/.zshrc | 121 +++++++++++++++++++++++++++++++++++++++++++ src/zsh-in-docker.sh | 2 + 4 files changed, 134 insertions(+), 7 deletions(-) create mode 100644 src/.zshrc diff --git a/Dockerfile b/Dockerfile index 909f4dc..559af02 100644 --- a/Dockerfile +++ b/Dockerfile @@ -49,8 +49,7 @@ RUN groupadd --gid $USER_GID $USERNAME \ USER $USERNAME # Install ZSH, OhMyZSH, themes and plugins -ADD src/zsh-in-docker.sh . -ADD --chown=1000:1000 src/.p10k.zsh /home/$USERNAME/.p10k.zsh +ADD --chown=1000:1000 --chmod=+x src/zsh-in-docker.sh . RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" RUN ./zsh-in-docker.sh \ -p git \ @@ -66,13 +65,18 @@ RUN ./zsh-in-docker.sh \ -p sudo \ -p tig \ -p dirhistory \ + -p history \ -a 'bindkey "\$terminfo[kcuu1]" history-substring-search-up' \ -a 'bindkey "\$terminfo[kcud1]" history-substring-search-down' \ -a '[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh' +# -p fzf-zsh-plugin \ +ADD --chown=1000:1000 src/.p10k.zsh /home/$USERNAME/.p10k.zsh -ADD src/tasks.py . +ADD --chown=1000:1000 src/.zshrc /home/$USERNAME/.zshrc +ADD --chown=1000:1000 src/.p10k.zsh /home/$USERNAME/.p10k.zsh -ADD https://private-sw-downloads.s3.amazonaws.com/archfx_broker/preflight/broker_preflight.sh . +ADD --chown=1000:1000 --chmod=+x src/tasks.py . +ADD --chown=1000:1000 --chmod=+x https://private-sw-downloads.s3.amazonaws.com/archfx_broker/preflight/broker_preflight.sh . # Set default command CMD ["/bin/zsh"] \ No newline at end of file diff --git a/src/.p10k.zsh b/src/.p10k.zsh index 2a6bf93..41ad6ce 100644 --- a/src/.p10k.zsh +++ b/src/.p10k.zsh @@ -1,5 +1,5 @@ -# Generated by Powerlevel10k configuration wizard on 2023-12-15 at 20:38 UTC. -# Based on romkatv/powerlevel10k/config/p10k-lean-8colors.zsh, checksum 27973. +# Generated by Powerlevel10k configuration wizard on 2023-12-20 at 00:23 UTC. +# Based on romkatv/powerlevel10k/config/p10k-lean-8colors.zsh, checksum 37096. # Wizard options: nerdfont-complete + powerline, small icons, lean_8colors, unicode, # 24h time, 2 lines, solid, right frame, green-ornaments, sparse, many icons, fluent, # instant_prompt=off. @@ -1355,7 +1355,7 @@ #[ aws: aws profile (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) ]# # Show aws only when the command you are typing invokes one of these tools. # Tip: Remove the next line to always show aws. - typeset -g POWERLEVEL9K_AWS_SHOW_ON_COMMAND='aws|awless|terraform|pulumi|terragrunt' + typeset -g POWERLEVEL9K_AWS_SHOW_ON_COMMAND='aws|awless|cdk|terraform|pulumi|terragrunt' # POWERLEVEL9K_AWS_CLASSES is an array with even number of elements. The first element # in each pair defines a pattern against which the current AWS profile gets matched. diff --git a/src/.zshrc b/src/.zshrc new file mode 100644 index 0000000..c749179 --- /dev/null +++ b/src/.zshrc @@ -0,0 +1,121 @@ +# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. +# Initialization code that may require console input (password prompts, [y/n] +# confirmations, etc.) must go above this block; everything else may go below. +if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then + source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" +fi + +# If you come from bash you might have to change your $PATH. +# export PATH=$HOME/bin:/usr/local/bin:$PATH + +# Path to your oh-my-zsh installation. +export ZSH="$HOME/.oh-my-zsh" + +# Set name of the theme to load --- if set to "random", it will +# load a random theme each time oh-my-zsh is loaded, in which case, +# to know which specific one was loaded, run: echo $RANDOM_THEME +# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes +#ZSH_THEME="robbyrussell" +ZSH_THEME="powerlevel10k/powerlevel10k" + +# Set list of themes to pick from when loading at random +# Setting this variable when ZSH_THEME=random will cause zsh to load +# a theme from this variable instead of looking in $ZSH/themes/ +# If set to an empty array, this variable will have no effect. +# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) + +# Uncomment the following line to use case-sensitive completion. +# CASE_SENSITIVE="true" + +# Uncomment the following line to use hyphen-insensitive completion. +# Case-sensitive completion must be off. _ and - will be interchangeable. +# HYPHEN_INSENSITIVE="true" + +# Uncomment one of the following lines to change the auto-update behavior +# zstyle ':omz:update' mode disabled # disable automatic updates +# zstyle ':omz:update' mode auto # update automatically without asking +# zstyle ':omz:update' mode reminder # just remind me to update when it's time + +# Uncomment the following line to change how often to auto-update (in days). +# zstyle ':omz:update' frequency 13 + +# Uncomment the following line if pasting URLs and other text is messed up. +# DISABLE_MAGIC_FUNCTIONS="true" + +# Uncomment the following line to disable colors in ls. +# DISABLE_LS_COLORS="true" + +# Uncomment the following line to disable auto-setting terminal title. +# DISABLE_AUTO_TITLE="true" + +# Uncomment the following line to enable command auto-correction. +# ENABLE_CORRECTION="true" + +# Uncomment the following line to display red dots whilst waiting for completion. +# You can also set it to another string to have that shown instead of the default red dots. +# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f" +# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765) +# COMPLETION_WAITING_DOTS="true" + +# Uncomment the following line if you want to disable marking untracked files +# under VCS as dirty. This makes repository status check for large repositories +# much, much faster. +# DISABLE_UNTRACKED_FILES_DIRTY="true" + +# Uncomment the following line if you want to change the command execution time +# stamp shown in the history command output. +# You can set one of the optional three formats: +# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" +# or set a custom format using the strftime function format specifications, +# see 'man strftime' for details. +# HIST_STAMPS="mm/dd/yyyy" + +# Would you like to use another custom folder than $ZSH/custom? +# ZSH_CUSTOM=/path/to/new-custom-folder + +# Which plugins would you like to load? +# Standard plugins can be found in $ZSH/plugins/ +# Custom plugins may be added to $ZSH_CUSTOM/plugins/ +# Example format: plugins=(rails git textmate ruby lighthouse) +# Add wisely, as too many plugins slow down shell startup. +plugins=(git docker colorize kubectl invoke aws colored-man-pages ubuntu history zsh-autosuggestions zsh-syntax-highlighting sudo web-search dirhistory jsontools tig kubectl aws) + +# See https://travis.media/top-10-oh-my-zsh-plugins-for-productive-developers/ +# +# git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions +# git clone https://github.com/zsh-users/zsh-syntax-highlighting ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting +# git clone https://github.com/unixorn/fzf-zsh-plugin.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/fzf-zsh-plugin +# sudo apt install python3-pygments + +source $ZSH/oh-my-zsh.sh + +# User configuration + +# export MANPATH="/usr/local/man:$MANPATH" + +# You may need to manually set your language environment +# export LANG=en_US.UTF-8 + +# Preferred editor for local and remote sessions +# if [[ -n $SSH_CONNECTION ]]; then +# export EDITOR='vim' +# else +# export EDITOR='mvim' +# fi + +# Compilation flags +# export ARCHFLAGS="-arch x86_64" + +# Set personal aliases, overriding those provided by oh-my-zsh libs, +# plugins, and themes. Aliases can be placed here, though oh-my-zsh +# users are encouraged to define aliases within the ZSH_CUSTOM folder. +# For a full list of active aliases, run `alias`. +# +# Example aliases +# alias zshconfig="mate ~/.zshrc" +# alias ohmyzsh="mate ~/.oh-my-zsh" + +# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. +[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh + +export TERM=xterm-256color \ No newline at end of file diff --git a/src/zsh-in-docker.sh b/src/zsh-in-docker.sh index c20c760..d2619e8 100755 --- a/src/zsh-in-docker.sh +++ b/src/zsh-in-docker.sh @@ -181,3 +181,5 @@ if [ "$THEME" = "default" ]; then git clone --depth 1 https://github.com/romkatv/powerlevel10k "$HOME"/.oh-my-zsh/custom/themes/powerlevel10k powerline10k_config >> "$HOME"/.zshrc fi + +#git clone --depth 1 https://github.com/unixorn/fzf-zsh-plugin.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/fzf-zsh-plugin From a0d219799aae68b48423ccde11ce4ca7fa1b6706 Mon Sep 17 00:00:00 2001 From: Garth Johnson Date: Wed, 20 Dec 2023 04:58:49 +0000 Subject: [PATCH 04/16] codespace font setting --- .vscode/settings.json | 3 +++ toolbox.code-workspace | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..534d4ca --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "editor.fontFamily": "'MesloLGS NF', 'Droid Sans Mono', 'monospace', monospace" +} \ No newline at end of file diff --git a/toolbox.code-workspace b/toolbox.code-workspace index c45cd23..cf0ff4e 100644 --- a/toolbox.code-workspace +++ b/toolbox.code-workspace @@ -5,6 +5,7 @@ } ], "settings": { - "window.autoDetectColorScheme": true + "window.autoDetectColorScheme": true, + "editor.fontFamily": "'MesloLGS NF', 'Droid Sans Mono', 'monospace', monospace" } } \ No newline at end of file From c819c5aa5bc0636de4622e4649ea16b80e695657 Mon Sep 17 00:00:00 2001 From: Garth Johnson Date: Thu, 28 Dec 2023 16:15:25 -0800 Subject: [PATCH 05/16] Coder (#6) * moar promptiness * more compatible with lesser fonting * add user to docker group * corrected docker lib reference * added dockerinfo to tasks * better separation of build env * Testing with badges and adding notes * Testing with badges and adding notes * changed workflow names --- .github/workflows/docker-publish-dh.yml | 2 +- .github/workflows/docker-publish.yml | 2 +- Dockerfile | 4 +- README.md | 21 +- docker-compose.yml | 18 +- src/.p10k.zsh | 652 ++++++++++++++---------- src/requirements.txt | 2 +- src/tasks.py | 52 +- 8 files changed, 460 insertions(+), 293 deletions(-) diff --git a/.github/workflows/docker-publish-dh.yml b/.github/workflows/docker-publish-dh.yml index bfe5d0a..7e95967 100644 --- a/.github/workflows/docker-publish-dh.yml +++ b/.github/workflows/docker-publish-dh.yml @@ -1,4 +1,4 @@ -name: Docker Hub +name: Docker Hub CI on: diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 202f47f..7983ba8 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -1,4 +1,4 @@ -name: Build +name: GitHub CI # This workflow uses actions that are not certified by GitHub. # They are provided by a third-party and are governed by diff --git a/Dockerfile b/Dockerfile index 559af02..4225674 100644 --- a/Dockerfile +++ b/Dockerfile @@ -39,11 +39,11 @@ RUN python3 -m pip install --no-cache-dir -r requirements.txt ARG USERNAME=netyeti ARG USER_UID=1000 ARG USER_GID=$USER_UID -RUN groupadd --gid $USER_GID $USERNAME \ +RUN groupadd --gid $USER_GID $USERNAME && groupadd --gid 999 docker \ && useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \ && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ && chmod 0440 /etc/sudoers.d/$USERNAME -#RUN usermod -aG docker $USERNAME +RUN usermod -aG docker $USERNAME # Switch to the user now so that file ownership matches USER $USERNAME diff --git a/README.md b/README.md index 17caccd..06fd01e 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,26 @@ # Toolbox -Containerized tools for on the go troubleshooting +[![ghcr.io](https://github.com/growlf/toolbox/actions/workflows/docker-publish.yml/badge.svg)](https://github.com/growlf/toolbox/actions/workflows/docker-publish.yml) +[![Docker Hub](https://github.com/growlf/toolbox/actions/workflows/docker-publish-dh.yml/badge.svg)](https://github.com/growlf/toolbox/actions/workflows/docker-publish-dh.yml) + +Containerized tools for on-the-go troubleshooting and developing in alien environments. By: Garth Johnson & others -The purpose of this container image is to provide tools that I use on a regular basis and would like to use on other systems without installing them to the bare-metal (leave minimal footprint and cleanup). +The purpose of this container image is to provide tools that can help diagnose issues and ease/simplify development struggles on alien envirnments. -Additionally, this container can also be easily used for +Additionally, this container image can easily used for: - devlopment new container prototypes - debugging container builds and deployments -- educational intents for container development/examples +- educational intents for container development/examples (i.e. workflows and devcontainers) You can find more at: - source: https://github.com/growlf/toolbox/ -- image: https://hub.docker.com/repository/docker/netyeti/toolbox/ +- release images: + - https://hub.docker.com/repository/docker/netyeti/toolbox/ + - ghcr.io/growlf/toolbox:latest ## Examples @@ -42,7 +47,5 @@ Some tasks to add to the default options: - https://github.com/romkatv/powerlevel10k - https://medium.com/nerd-for-tech/my-python-boilerplate-and-a-little-python-fu-e0ed59d97627 - https://pypi.org/project/portscan/ - - -[![ghcr.io](https://github.com/growlf/toolbox/actions/workflows/docker-publish.yml/badge.svg)](https://github.com/growlf/toolbox/actions/workflows/docker-publish.yml) -[![Docker Hub](https://github.com/growlf/toolbox/actions/workflows/docker-publish-dh.yml/badge.svg)](https://github.com/growlf/toolbox/actions/workflows/docker-publish-dh.yml) \ No newline at end of file +- https://docs.pyinvoke.org/en/stable/ +- https://docker-py.readthedocs.io/en/stable/ diff --git a/docker-compose.yml b/docker-compose.yml index de7e7a0..7c3b272 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,8 +1,8 @@ version: '3.8' services: - # Example container with DooD and host file/net access - app: + # Building and testing environment + dev: build: context: . dockerfile: Dockerfile @@ -12,11 +12,25 @@ services: stdin_open: true tty: true command: ["/bin/zsh"] + volumes: + - ${PWD}:/app + - /var/run/docker.sock:/var/run/docker.sock + network_mode: "host" + + # Example container with DooD and host file/net access + app1: + image: ghcr.io/growlf/toolbox:latest + environment: + - TESTVAR=${TESTVAR:-app2} + stdin_open: true + tty: true + command: ["/bin/zsh"] volumes: - /:/host - /var/run/docker.sock:/var/run/docker.sock network_mode: "host" + # Example of running the same image with different intent app2: image: ghcr.io/growlf/toolbox:latest diff --git a/src/.p10k.zsh b/src/.p10k.zsh index 41ad6ce..e322dd4 100644 --- a/src/.p10k.zsh +++ b/src/.p10k.zsh @@ -1,12 +1,12 @@ -# Generated by Powerlevel10k configuration wizard on 2023-12-20 at 00:23 UTC. -# Based on romkatv/powerlevel10k/config/p10k-lean-8colors.zsh, checksum 37096. -# Wizard options: nerdfont-complete + powerline, small icons, lean_8colors, unicode, -# 24h time, 2 lines, solid, right frame, green-ornaments, sparse, many icons, fluent, +# Generated by Powerlevel10k configuration wizard on 2023-12-28 at 19:46 UTC. +# Based on romkatv/powerlevel10k/config/p10k-rainbow.zsh, checksum 04117. +# Wizard options: powerline, rainbow, unicode, 24h time, angled separators, sharp heads, +# flat tails, 2 lines, solid, right frame, dark-ornaments, sparse, fluent, # instant_prompt=off. # Type `p10k configure` to generate another config. # -# Config for Powerlevel10k with 8-color lean prompt style. Type `p10k configure` to generate -# your own config based on it. +# Config for Powerlevel10k with powerline prompt style with colorful background. +# Type `p10k configure` to generate your own config based on it. # # Tip: Looking for a nice color? Here's a one-liner to print colormap. # @@ -95,40 +95,34 @@ midnight_commander # midnight commander shell (https://midnight-commander.org/) nix_shell # nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html) chezmoi_shell # chezmoi shell (https://www.chezmoi.io/) - # vpn_ip # virtual private network indicator - # load # CPU load - # disk_usage # disk usage - # ram # free RAM + vi_mode # vi mode (you don't need this if you've enabled prompt_char) + vpn_ip # virtual private network indicator + load # CPU load + disk_usage # disk usage + ram # free RAM # swap # used swap todo # todo items (https://github.com/todotxt/todo.txt-cli) timewarrior # timewarrior tracking status (https://timewarrior.net/) taskwarrior # taskwarrior task count (https://taskwarrior.org/) per_directory_history # Oh My Zsh per-directory-history local/global indicator - # cpu_arch # CPU architecture + cpu_arch # CPU architecture time # current time # =========================[ Line #2 ]========================= - newline # \n - # ip # ip address and bandwidth usage for a specified network interface - # public_ip # public IP address - # proxy # system-wide http/https/ftp proxy - # battery # internal battery - # wifi # wifi speed + newline + ip # ip address and bandwidth usage for a specified network interface + public_ip # public IP address + proxy # system-wide http/https/ftp proxy + battery # internal battery + wifi # wifi speed # example # example user-defined segment (see prompt_example function below) ) # Defines character set used by powerlevel10k. It's best to let `p10k configure` set it for you. - typeset -g POWERLEVEL9K_MODE=nerdfont-complete + typeset -g POWERLEVEL9K_MODE=powerline # When set to `moderate`, some icons will have an extra space after them. This is meant to avoid # icon overlap when using non-monospace fonts. When set to `none`, spaces are not added. typeset -g POWERLEVEL9K_ICON_PADDING=none - # Basic style options that define the overall look of your prompt. You probably don't want to - # change them. - typeset -g POWERLEVEL9K_BACKGROUND= # transparent background - typeset -g POWERLEVEL9K_{LEFT,RIGHT}_{LEFT,RIGHT}_WHITESPACE= # no surrounding whitespace - typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SUBSEGMENT_SEPARATOR=' ' # separate segments with a space - typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SEGMENT_SEPARATOR= # no end-of-line symbol - # When set to true, icons appear before content on both sides of the prompt. When set # to false, icons go after content. If empty or not set, icons go before content in the left # prompt and after content in the right prompt. @@ -145,58 +139,69 @@ # Add an empty line before each prompt. typeset -g POWERLEVEL9K_PROMPT_ADD_NEWLINE=true - # Connect left prompt lines with these symbols. + # Connect left prompt lines with these symbols. You'll probably want to use the same color + # as POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_FOREGROUND below. typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX= typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_PREFIX= typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX= # Connect right prompt lines with these symbols. - typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_SUFFIX='%2F─╮' - typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_SUFFIX='%2F─┤' - typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_SUFFIX='%2F─╯' - - # The left end of left prompt. - typeset -g POWERLEVEL9K_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL= - # The right end of right prompt. - typeset -g POWERLEVEL9K_RIGHT_PROMPT_LAST_SEGMENT_END_SYMBOL=' ' - - # Ruler, a.k.a. the horizontal line before each prompt. If you set it to true, you'll - # probably want to set POWERLEVEL9K_PROMPT_ADD_NEWLINE=false above and - # POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR=' ' below. - typeset -g POWERLEVEL9K_SHOW_RULER=false - typeset -g POWERLEVEL9K_RULER_CHAR='─' # reasonable alternative: '·' - typeset -g POWERLEVEL9K_RULER_FOREGROUND=2 - - # Filler between left and right prompt on the first prompt line. You can set it to '·' or '─' - # to make it easier to see the alignment between left and right prompt and to separate prompt - # from command output. It serves the same purpose as ruler (see above) without increasing - # the number of prompt lines. You'll probably want to set POWERLEVEL9K_SHOW_RULER=false - # if using this. You might also like POWERLEVEL9K_PROMPT_ADD_NEWLINE=false for more compact - # prompt. + typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_SUFFIX='%240F─╮' + typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_SUFFIX='%240F─┤' + typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_SUFFIX='%240F─╯' + + # Filler between left and right prompt on the first prompt line. You can set it to ' ', '·' or + # '─'. The last two make it easier to see the alignment between left and right prompt and to + # separate prompt from command output. You might want to set POWERLEVEL9K_PROMPT_ADD_NEWLINE=false + # for more compact prompt if using this option. typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR='─' + typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_BACKGROUND= + typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_GAP_BACKGROUND= if [[ $POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR != ' ' ]]; then - # The color of the filler. - typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_FOREGROUND=2 - # Add a space between the end of left prompt and the filler. - typeset -g POWERLEVEL9K_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL=' ' - # Add a space between the filler and the start of right prompt. - typeset -g POWERLEVEL9K_RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL=' ' + # The color of the filler. You'll probably want to match the color of POWERLEVEL9K_MULTILINE + # ornaments defined above. + typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_FOREGROUND=240 # Start filler from the edge of the screen if there are no left segments on the first line. typeset -g POWERLEVEL9K_EMPTY_LINE_LEFT_PROMPT_FIRST_SEGMENT_END_SYMBOL='%{%}' # End filler on the edge of the screen if there are no right segments on the first line. typeset -g POWERLEVEL9K_EMPTY_LINE_RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL='%{%}' fi + # Separator between same-color segments on the left. + typeset -g POWERLEVEL9K_LEFT_SUBSEGMENT_SEPARATOR='\uE0B1' + # Separator between same-color segments on the right. + typeset -g POWERLEVEL9K_RIGHT_SUBSEGMENT_SEPARATOR='\uE0B3' + # Separator between different-color segments on the left. + typeset -g POWERLEVEL9K_LEFT_SEGMENT_SEPARATOR='\uE0B0' + # Separator between different-color segments on the right. + typeset -g POWERLEVEL9K_RIGHT_SEGMENT_SEPARATOR='\uE0B2' + # To remove a separator between two segments, add "_joined" to the second segment name. + # For example: POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(os_icon context_joined) + + # The right end of left prompt. + typeset -g POWERLEVEL9K_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL='\uE0B0' + # The left end of right prompt. + typeset -g POWERLEVEL9K_RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL='\uE0B2' + # The left end of left prompt. + typeset -g POWERLEVEL9K_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL='' + # The right end of right prompt. + typeset -g POWERLEVEL9K_RIGHT_PROMPT_LAST_SEGMENT_END_SYMBOL='' + # Left prompt terminator for lines without any segments. + typeset -g POWERLEVEL9K_EMPTY_LINE_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL= + #################################[ os_icon: os identifier ]################################## # OS identifier color. - typeset -g POWERLEVEL9K_OS_ICON_FOREGROUND= + typeset -g POWERLEVEL9K_OS_ICON_FOREGROUND=232 + typeset -g POWERLEVEL9K_OS_ICON_BACKGROUND=7 # Custom icon. # typeset -g POWERLEVEL9K_OS_ICON_CONTENT_EXPANSION='⭐' ################################[ prompt_char: prompt symbol ]################################ + # Transparent background. + typeset -g POWERLEVEL9K_PROMPT_CHAR_BACKGROUND= # Green prompt symbol if the last command succeeded. - typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS,VIOWR}_FOREGROUND=2 + typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS,VIOWR}_FOREGROUND=76 # Red prompt symbol if the last command failed. - typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS,VIOWR}_FOREGROUND=1 + typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS,VIOWR}_FOREGROUND=196 # Default prompt symbol. typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIINS_CONTENT_EXPANSION='❯' # Prompt symbol in command vi mode. @@ -207,25 +212,29 @@ typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIOWR_CONTENT_EXPANSION='▶' typeset -g POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=true # No line terminator if prompt_char is the last segment. - typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL='' + typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL= # No line introducer if prompt_char is the first segment. typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL= + # No surrounding whitespace. + typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_{LEFT,RIGHT}_WHITESPACE= ##################################[ dir: current directory ]################################## - # Default current directory color. - typeset -g POWERLEVEL9K_DIR_FOREGROUND=4 + # Current directory background color. + typeset -g POWERLEVEL9K_DIR_BACKGROUND=4 + # Default current directory foreground color. + typeset -g POWERLEVEL9K_DIR_FOREGROUND=254 # If directory is too long, shorten some of its segments to the shortest possible unique # prefix. The shortened directory can be tab-completed to the original. typeset -g POWERLEVEL9K_SHORTEN_STRATEGY=truncate_to_unique # Replace removed segment suffixes with this symbol. typeset -g POWERLEVEL9K_SHORTEN_DELIMITER= # Color of the shortened directory segments. - typeset -g POWERLEVEL9K_DIR_SHORTENED_FOREGROUND=4 + typeset -g POWERLEVEL9K_DIR_SHORTENED_FOREGROUND=250 # Color of the anchor directory segments. Anchor segments are never shortened. The first # segment is always an anchor. - typeset -g POWERLEVEL9K_DIR_ANCHOR_FOREGROUND=4 - # Set to true to display anchor directory segments in bold. - typeset -g POWERLEVEL9K_DIR_ANCHOR_BOLD=false + typeset -g POWERLEVEL9K_DIR_ANCHOR_FOREGROUND=255 + # Display anchor directory segments in bold. + typeset -g POWERLEVEL9K_DIR_ANCHOR_BOLD=true # Don't shorten directories that contain any of these files. They are anchors. local anchor_files=( .bzr @@ -283,17 +292,13 @@ # the full directory that was used in previous commands. typeset -g POWERLEVEL9K_DIR_HYPERLINK=false - # Enable special styling for non-writable directories. See POWERLEVEL9K_LOCK_ICON and - # POWERLEVEL9K_DIR_CLASSES below. - typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=v2 - # Enable special styling for non-writable and non-existent directories. See POWERLEVEL9K_LOCK_ICON # and POWERLEVEL9K_DIR_CLASSES below. typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=v3 # The default icon shown next to non-writable and non-existent directories when # POWERLEVEL9K_DIR_SHOW_WRITABLE is set to v3. - # typeset -g POWERLEVEL9K_LOCK_ICON='⭐' + typeset -g POWERLEVEL9K_LOCK_ICON='∅' # POWERLEVEL9K_DIR_CLASSES allows you to specify custom icons and colors for different # directories. It must be an array with 3 * N elements. Each triplet consists of: @@ -324,34 +329,44 @@ # # # Styling for WORK. # typeset -g POWERLEVEL9K_DIR_WORK_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_DIR_WORK_FOREGROUND=4 - # typeset -g POWERLEVEL9K_DIR_WORK_SHORTENED_FOREGROUND=4 - # typeset -g POWERLEVEL9K_DIR_WORK_ANCHOR_FOREGROUND=4 + # typeset -g POWERLEVEL9K_DIR_WORK_BACKGROUND=4 + # typeset -g POWERLEVEL9K_DIR_WORK_FOREGROUND=254 + # typeset -g POWERLEVEL9K_DIR_WORK_SHORTENED_FOREGROUND=250 + # typeset -g POWERLEVEL9K_DIR_WORK_ANCHOR_FOREGROUND=255 # # # Styling for WORK_NOT_WRITABLE. # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_FOREGROUND=4 - # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_SHORTENED_FOREGROUND=4 - # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_ANCHOR_FOREGROUND=4# + # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_BACKGROUND=4 + # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_FOREGROUND=254 + # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_SHORTENED_FOREGROUND=250 + # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_ANCHOR_FOREGROUND=255 # - # Styling for WORK_NON_EXISTENT. + # # Styling for WORK_NON_EXISTENT. # typeset -g POWERLEVEL9K_DIR_WORK_NON_EXISTENT_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_DIR_WORK_NON_EXISTENT_FOREGROUND=4 - # typeset -g POWERLEVEL9K_DIR_WORK_NON_EXISTENT_SHORTENED_FOREGROUND=4 - # typeset -g POWERLEVEL9K_DIR_WORK_NON_EXISTENT_ANCHOR_FOREGROUND=4 + # typeset -g POWERLEVEL9K_DIR_WORK_NON_EXISTENT_BACKGROUND=4 + # typeset -g POWERLEVEL9K_DIR_WORK_NON_EXISTENT_FOREGROUND=254 + # typeset -g POWERLEVEL9K_DIR_WORK_NON_EXISTENT_SHORTENED_FOREGROUND=250 + # typeset -g POWERLEVEL9K_DIR_WORK_NON_EXISTENT_ANCHOR_FOREGROUND=255 # # If a styling parameter isn't explicitly defined for some class, it falls back to the classless # parameter. For example, if POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_FOREGROUND is not set, it falls # back to POWERLEVEL9K_DIR_FOREGROUND. # - # typeset -g POWERLEVEL9K_DIR_CLASSES=() + typeset -g POWERLEVEL9K_DIR_CLASSES=() # Custom prefix. - # typeset -g POWERLEVEL9K_DIR_PREFIX='%fin ' + # typeset -g POWERLEVEL9K_DIR_PREFIX='in ' #####################################[ vcs: git status ]###################################### + # Version control background colors. + typeset -g POWERLEVEL9K_VCS_CLEAN_BACKGROUND=2 + typeset -g POWERLEVEL9K_VCS_MODIFIED_BACKGROUND=3 + typeset -g POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND=2 + typeset -g POWERLEVEL9K_VCS_CONFLICTED_BACKGROUND=3 + typeset -g POWERLEVEL9K_VCS_LOADING_BACKGROUND=8 + # Branch icon. Set this parameter to '\UE0A0 ' for the popular Powerline branch icon. - typeset -g POWERLEVEL9K_VCS_BRANCH_ICON='\uF126 ' + typeset -g POWERLEVEL9K_VCS_BRANCH_ICON= # Untracked files icon. It's really a question mark, your font isn't broken. # Change the value of this parameter to show a different icon. @@ -375,21 +390,12 @@ return fi - if (( $1 )); then - # Styling for up-to-date Git status. - local meta='%f' # default foreground - local clean='%2F' # green foreground - local modified='%3F' # yellow foreground - local untracked='%4F' # blue foreground - local conflicted='%1F' # red foreground - else - # Styling for incomplete and stale Git status. - local meta='%f' # default foreground - local clean='%f' # default foreground - local modified='%f' # default foreground - local untracked='%f' # default foreground - local conflicted='%f' # default foreground - fi + # Styling for different parts of Git status. + local meta='%7F' # white foreground + local clean='%0F' # black foreground + local modified='%0F' # black foreground + local untracked='%0F' # black foreground + local conflicted='%1F' # red foreground local res @@ -488,30 +494,20 @@ # Disable the default Git status formatting. typeset -g POWERLEVEL9K_VCS_DISABLE_GITSTATUS_FORMATTING=true # Install our own Git status formatter. - typeset -g POWERLEVEL9K_VCS_CONTENT_EXPANSION='${$((my_git_formatter(1)))+${my_git_format}}' - typeset -g POWERLEVEL9K_VCS_LOADING_CONTENT_EXPANSION='${$((my_git_formatter(0)))+${my_git_format}}' + typeset -g POWERLEVEL9K_VCS_CONTENT_EXPANSION='${$((my_git_formatter()))+${my_git_format}}' # Enable counters for staged, unstaged, etc. typeset -g POWERLEVEL9K_VCS_{STAGED,UNSTAGED,UNTRACKED,CONFLICTED,COMMITS_AHEAD,COMMITS_BEHIND}_MAX_NUM=-1 - # Icon color. - typeset -g POWERLEVEL9K_VCS_VISUAL_IDENTIFIER_COLOR=2 - typeset -g POWERLEVEL9K_VCS_LOADING_VISUAL_IDENTIFIER_COLOR= # Custom icon. - # typeset -g POWERLEVEL9K_VCS_VISUAL_IDENTIFIER_EXPANSION='⭐' + typeset -g POWERLEVEL9K_VCS_VISUAL_IDENTIFIER_EXPANSION= # Custom prefix. - typeset -g POWERLEVEL9K_VCS_PREFIX='%fon ' + typeset -g POWERLEVEL9K_VCS_PREFIX='on ' # Show status of repositories of these types. You can add svn and/or hg if you are # using them. If you do, your prompt may become slow even when your current directory # isn't in an svn or hg repository. typeset -g POWERLEVEL9K_VCS_BACKENDS=(git) - # These settings are used for repositories other than Git or when gitstatusd fails and - # Powerlevel10k has to fall back to using vcs_info. - typeset -g POWERLEVEL9K_VCS_CLEAN_FOREGROUND=2 - typeset -g POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND=2 - typeset -g POWERLEVEL9K_VCS_MODIFIED_FOREGROUND=3 - ##########################[ status: exit code of the last command ]########################### # Enable OK_PIPE, ERROR_PIPE and ERROR_SIGNAL status states to allow us to enable, disable and # style them independently from the regular OK and ERROR state. @@ -520,66 +516,76 @@ # Status on success. No content, just an icon. No need to show it if prompt_char is enabled as # it will signify success by turning green. typeset -g POWERLEVEL9K_STATUS_OK=false - typeset -g POWERLEVEL9K_STATUS_OK_FOREGROUND=2 typeset -g POWERLEVEL9K_STATUS_OK_VISUAL_IDENTIFIER_EXPANSION='✔' + typeset -g POWERLEVEL9K_STATUS_OK_FOREGROUND=2 + typeset -g POWERLEVEL9K_STATUS_OK_BACKGROUND=0 # Status when some part of a pipe command fails but the overall exit status is zero. It may look # like this: 1|0. typeset -g POWERLEVEL9K_STATUS_OK_PIPE=true - typeset -g POWERLEVEL9K_STATUS_OK_PIPE_FOREGROUND=2 typeset -g POWERLEVEL9K_STATUS_OK_PIPE_VISUAL_IDENTIFIER_EXPANSION='✔' + typeset -g POWERLEVEL9K_STATUS_OK_PIPE_FOREGROUND=2 + typeset -g POWERLEVEL9K_STATUS_OK_PIPE_BACKGROUND=0 # Status when it's just an error code (e.g., '1'). No need to show it if prompt_char is enabled as # it will signify error by turning red. typeset -g POWERLEVEL9K_STATUS_ERROR=false - typeset -g POWERLEVEL9K_STATUS_ERROR_FOREGROUND=1 typeset -g POWERLEVEL9K_STATUS_ERROR_VISUAL_IDENTIFIER_EXPANSION='✘' + typeset -g POWERLEVEL9K_STATUS_ERROR_FOREGROUND=3 + typeset -g POWERLEVEL9K_STATUS_ERROR_BACKGROUND=1 # Status when the last command was terminated by a signal. typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL=true - typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_FOREGROUND=1 # Use terse signal names: "INT" instead of "SIGINT(2)". typeset -g POWERLEVEL9K_STATUS_VERBOSE_SIGNAME=false typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_VISUAL_IDENTIFIER_EXPANSION='✘' + typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_FOREGROUND=3 + typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_BACKGROUND=1 # Status when some part of a pipe command fails and the overall exit status is also non-zero. # It may look like this: 1|0. typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE=true - typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE_FOREGROUND=1 typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE_VISUAL_IDENTIFIER_EXPANSION='✘' + typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE_FOREGROUND=3 + typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE_BACKGROUND=1 ###################[ command_execution_time: duration of the last command ]################### + # Execution time color. + typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=0 + typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_BACKGROUND=3 # Show duration of the last command if takes at least this many seconds. typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=3 # Show this many fractional digits. Zero means round to seconds. typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0 - # Execution time color. - typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=3 # Duration format: 1d 2h 3m 4s. typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT='d h m s' # Custom icon. - # typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_VISUAL_IDENTIFIER_EXPANSION='⭐' + typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_VISUAL_IDENTIFIER_EXPANSION= # Custom prefix. - typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PREFIX='%ftook ' + typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PREFIX='took ' #######################[ background_jobs: presence of background jobs ]####################### + # Background jobs color. + typeset -g POWERLEVEL9K_BACKGROUND_JOBS_FOREGROUND=6 + typeset -g POWERLEVEL9K_BACKGROUND_JOBS_BACKGROUND=0 # Don't show the number of background jobs. typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE=false - # Background jobs color. - typeset -g POWERLEVEL9K_BACKGROUND_JOBS_FOREGROUND=1 # Custom icon. - # typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VISUAL_IDENTIFIER_EXPANSION='⭐' + typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VISUAL_IDENTIFIER_EXPANSION='≡' #######################[ direnv: direnv status (https://direnv.net/) ]######################## # Direnv color. typeset -g POWERLEVEL9K_DIRENV_FOREGROUND=3 + typeset -g POWERLEVEL9K_DIRENV_BACKGROUND=0 # Custom icon. # typeset -g POWERLEVEL9K_DIRENV_VISUAL_IDENTIFIER_EXPANSION='⭐' ###############[ asdf: asdf version manager (https://github.com/asdf-vm/asdf) ]############### # Default asdf color. Only used to display tools for which there is no color override (see below). - # Tip: Override this parameter for ${TOOL} with POWERLEVEL9K_ASDF_${TOOL}_FOREGROUND. - typeset -g POWERLEVEL9K_ASDF_FOREGROUND=6 + # Tip: Override these parameters for ${TOOL} with POWERLEVEL9K_ASDF_${TOOL}_FOREGROUND and + # POWERLEVEL9K_ASDF_${TOOL}_BACKGROUND. + typeset -g POWERLEVEL9K_ASDF_FOREGROUND=0 + typeset -g POWERLEVEL9K_ASDF_BACKGROUND=7 # There are four parameters that can be used to hide asdf tools. Each parameter describes # conditions under which a tool gets hidden. Parameters can hide tools but not unhide them. If at @@ -637,133 +643,157 @@ typeset -g POWERLEVEL9K_ASDF_SHOW_ON_UPGLOB= # Ruby version from asdf. - typeset -g POWERLEVEL9K_ASDF_RUBY_FOREGROUND=1 + typeset -g POWERLEVEL9K_ASDF_RUBY_FOREGROUND=0 + typeset -g POWERLEVEL9K_ASDF_RUBY_BACKGROUND=1 # typeset -g POWERLEVEL9K_ASDF_RUBY_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_ASDF_RUBY_SHOW_ON_UPGLOB='*.foo|*.bar' # Python version from asdf. - typeset -g POWERLEVEL9K_ASDF_PYTHON_FOREGROUND=6 + typeset -g POWERLEVEL9K_ASDF_PYTHON_FOREGROUND=0 + typeset -g POWERLEVEL9K_ASDF_PYTHON_BACKGROUND=4 # typeset -g POWERLEVEL9K_ASDF_PYTHON_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_ASDF_PYTHON_SHOW_ON_UPGLOB='*.foo|*.bar' # Go version from asdf. - typeset -g POWERLEVEL9K_ASDF_GOLANG_FOREGROUND=6 + typeset -g POWERLEVEL9K_ASDF_GOLANG_FOREGROUND=0 + typeset -g POWERLEVEL9K_ASDF_GOLANG_BACKGROUND=4 # typeset -g POWERLEVEL9K_ASDF_GOLANG_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_ASDF_GOLANG_SHOW_ON_UPGLOB='*.foo|*.bar' # Node.js version from asdf. - typeset -g POWERLEVEL9K_ASDF_NODEJS_FOREGROUND=2 + typeset -g POWERLEVEL9K_ASDF_NODEJS_FOREGROUND=0 + typeset -g POWERLEVEL9K_ASDF_NODEJS_BACKGROUND=2 # typeset -g POWERLEVEL9K_ASDF_NODEJS_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_ASDF_NODEJS_SHOW_ON_UPGLOB='*.foo|*.bar' # Rust version from asdf. - typeset -g POWERLEVEL9K_ASDF_RUST_FOREGROUND=4 + typeset -g POWERLEVEL9K_ASDF_RUST_FOREGROUND=0 + typeset -g POWERLEVEL9K_ASDF_RUST_BACKGROUND=208 # typeset -g POWERLEVEL9K_ASDF_RUST_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_ASDF_RUST_SHOW_ON_UPGLOB='*.foo|*.bar' # .NET Core version from asdf. - typeset -g POWERLEVEL9K_ASDF_DOTNET_CORE_FOREGROUND=5 + typeset -g POWERLEVEL9K_ASDF_DOTNET_CORE_FOREGROUND=0 + typeset -g POWERLEVEL9K_ASDF_DOTNET_CORE_BACKGROUND=5 # typeset -g POWERLEVEL9K_ASDF_DOTNET_CORE_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_ASDF_DOTNET_CORE_SHOW_ON_UPGLOB='*.foo|*.bar' # Flutter version from asdf. - typeset -g POWERLEVEL9K_ASDF_FLUTTER_FOREGROUND=4 + typeset -g POWERLEVEL9K_ASDF_FLUTTER_FOREGROUND=0 + typeset -g POWERLEVEL9K_ASDF_FLUTTER_BACKGROUND=4 # typeset -g POWERLEVEL9K_ASDF_FLUTTER_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_ASDF_FLUTTER_SHOW_ON_UPGLOB='*.foo|*.bar' # Lua version from asdf. - typeset -g POWERLEVEL9K_ASDF_LUA_FOREGROUND=4 + typeset -g POWERLEVEL9K_ASDF_LUA_FOREGROUND=0 + typeset -g POWERLEVEL9K_ASDF_LUA_BACKGROUND=4 # typeset -g POWERLEVEL9K_ASDF_LUA_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_ASDF_LUA_SHOW_ON_UPGLOB='*.foo|*.bar' # Java version from asdf. - typeset -g POWERLEVEL9K_ASDF_JAVA_FOREGROUND=4 + typeset -g POWERLEVEL9K_ASDF_JAVA_FOREGROUND=1 + typeset -g POWERLEVEL9K_ASDF_JAVA_BACKGROUND=7 # typeset -g POWERLEVEL9K_ASDF_JAVA_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_ASDF_JAVA_SHOW_ON_UPGLOB='*.foo|*.bar' # Perl version from asdf. - typeset -g POWERLEVEL9K_ASDF_PERL_FOREGROUND=6 + typeset -g POWERLEVEL9K_ASDF_PERL_FOREGROUND=0 + typeset -g POWERLEVEL9K_ASDF_PERL_BACKGROUND=4 # typeset -g POWERLEVEL9K_ASDF_PERL_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_ASDF_PERL_SHOW_ON_UPGLOB='*.foo|*.bar' # Erlang version from asdf. - typeset -g POWERLEVEL9K_ASDF_ERLANG_FOREGROUND=1 + typeset -g POWERLEVEL9K_ASDF_ERLANG_FOREGROUND=0 + typeset -g POWERLEVEL9K_ASDF_ERLANG_BACKGROUND=1 # typeset -g POWERLEVEL9K_ASDF_ERLANG_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_ASDF_ERLANG_SHOW_ON_UPGLOB='*.foo|*.bar' # Elixir version from asdf. - typeset -g POWERLEVEL9K_ASDF_ELIXIR_FOREGROUND=5 + typeset -g POWERLEVEL9K_ASDF_ELIXIR_FOREGROUND=0 + typeset -g POWERLEVEL9K_ASDF_ELIXIR_BACKGROUND=5 # typeset -g POWERLEVEL9K_ASDF_ELIXIR_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_ASDF_ELIXIR_SHOW_ON_UPGLOB='*.foo|*.bar' # Postgres version from asdf. - typeset -g POWERLEVEL9K_ASDF_POSTGRES_FOREGROUND=6 + typeset -g POWERLEVEL9K_ASDF_POSTGRES_FOREGROUND=0 + typeset -g POWERLEVEL9K_ASDF_POSTGRES_BACKGROUND=6 # typeset -g POWERLEVEL9K_ASDF_POSTGRES_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_ASDF_POSTGRES_SHOW_ON_UPGLOB='*.foo|*.bar' # PHP version from asdf. - typeset -g POWERLEVEL9K_ASDF_PHP_FOREGROUND=5 + typeset -g POWERLEVEL9K_ASDF_PHP_FOREGROUND=0 + typeset -g POWERLEVEL9K_ASDF_PHP_BACKGROUND=5 # typeset -g POWERLEVEL9K_ASDF_PHP_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_ASDF_PHP_SHOW_ON_UPGLOB='*.foo|*.bar' # Haskell version from asdf. - typeset -g POWERLEVEL9K_ASDF_HASKELL_FOREGROUND=3 + typeset -g POWERLEVEL9K_ASDF_HASKELL_FOREGROUND=0 + typeset -g POWERLEVEL9K_ASDF_HASKELL_BACKGROUND=3 # typeset -g POWERLEVEL9K_ASDF_HASKELL_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_ASDF_HASKELL_SHOW_ON_UPGLOB='*.foo|*.bar' # Julia version from asdf. - typeset -g POWERLEVEL9K_ASDF_JULIA_FOREGROUND=2 + typeset -g POWERLEVEL9K_ASDF_JULIA_FOREGROUND=0 + typeset -g POWERLEVEL9K_ASDF_JULIA_BACKGROUND=2 # typeset -g POWERLEVEL9K_ASDF_JULIA_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_ASDF_JULIA_SHOW_ON_UPGLOB='*.foo|*.bar' ##########[ nordvpn: nordvpn connection status, linux only (https://nordvpn.com/) ]########### # NordVPN connection indicator color. - typeset -g POWERLEVEL9K_NORDVPN_FOREGROUND=6 + typeset -g POWERLEVEL9K_NORDVPN_FOREGROUND=7 + typeset -g POWERLEVEL9K_NORDVPN_BACKGROUND=4 # Hide NordVPN connection indicator when not connected. typeset -g POWERLEVEL9K_NORDVPN_{DISCONNECTED,CONNECTING,DISCONNECTING}_CONTENT_EXPANSION= typeset -g POWERLEVEL9K_NORDVPN_{DISCONNECTED,CONNECTING,DISCONNECTING}_VISUAL_IDENTIFIER_EXPANSION= # Custom icon. - # typeset -g POWERLEVEL9K_NORDVPN_VISUAL_IDENTIFIER_EXPANSION='⭐' + typeset -g POWERLEVEL9K_NORDVPN_VISUAL_IDENTIFIER_EXPANSION='nord' #################[ ranger: ranger shell (https://github.com/ranger/ranger) ]################## # Ranger shell color. typeset -g POWERLEVEL9K_RANGER_FOREGROUND=3 + typeset -g POWERLEVEL9K_RANGER_BACKGROUND=0 # Custom icon. - # typeset -g POWERLEVEL9K_RANGER_VISUAL_IDENTIFIER_EXPANSION='⭐' + typeset -g POWERLEVEL9K_RANGER_VISUAL_IDENTIFIER_EXPANSION='▲' ######################[ nnn: nnn shell (https://github.com/jarun/nnn) ]####################### # Nnn shell color. - typeset -g POWERLEVEL9K_NNN_FOREGROUND=3 + typeset -g POWERLEVEL9K_NNN_FOREGROUND=0 + typeset -g POWERLEVEL9K_NNN_BACKGROUND=6 # Custom icon. # typeset -g POWERLEVEL9K_NNN_VISUAL_IDENTIFIER_EXPANSION='⭐' ######################[ lf: lf shell (https://github.com/gokcehan/lf) ]####################### # lf shell color. - typeset -g POWERLEVEL9K_LF_FOREGROUND=3 + typeset -g POWERLEVEL9K_LF_FOREGROUND=0 + typeset -g POWERLEVEL9K_LF_BACKGROUND=6 # Custom icon. # typeset -g POWERLEVEL9K_LF_VISUAL_IDENTIFIER_EXPANSION='⭐' ##################[ xplr: xplr shell (https://github.com/sayanarijit/xplr) ]################## # xplr shell color. - typeset -g POWERLEVEL9K_XPLR_FOREGROUND=3 + typeset -g POWERLEVEL9K_XPLR_FOREGROUND=0 + typeset -g POWERLEVEL9K_XPLR_BACKGROUND=6 # Custom icon. # typeset -g POWERLEVEL9K_XPLR_VISUAL_IDENTIFIER_EXPANSION='⭐' ###########################[ vim_shell: vim shell indicator (:sh) ]########################### # Vim shell indicator color. - typeset -g POWERLEVEL9K_VIM_SHELL_FOREGROUND=3 + typeset -g POWERLEVEL9K_VIM_SHELL_FOREGROUND=0 + typeset -g POWERLEVEL9K_VIM_SHELL_BACKGROUND=2 # Custom icon. # typeset -g POWERLEVEL9K_VIM_SHELL_VISUAL_IDENTIFIER_EXPANSION='⭐' ######[ midnight_commander: midnight commander shell (https://midnight-commander.org/) ]###### # Midnight Commander shell color. typeset -g POWERLEVEL9K_MIDNIGHT_COMMANDER_FOREGROUND=3 + typeset -g POWERLEVEL9K_MIDNIGHT_COMMANDER_BACKGROUND=0 # Custom icon. # typeset -g POWERLEVEL9K_MIDNIGHT_COMMANDER_VISUAL_IDENTIFIER_EXPANSION='⭐' #[ nix_shell: nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html) ]## # Nix shell color. - typeset -g POWERLEVEL9K_NIX_SHELL_FOREGROUND=4 + typeset -g POWERLEVEL9K_NIX_SHELL_FOREGROUND=0 + typeset -g POWERLEVEL9K_NIX_SHELL_BACKGROUND=4 # Display the icon of nix_shell if PATH contains a subdirectory of /nix/store. # typeset -g POWERLEVEL9K_NIX_SHELL_INFER_FROM_PATH=false @@ -776,15 +806,19 @@ ##################[ chezmoi_shell: chezmoi shell (https://www.chezmoi.io/) ]################## # chezmoi shell color. - typeset -g POWERLEVEL9K_CHEZMOI_SHELL_FOREGROUND=4 + typeset -g POWERLEVEL9K_CHEZMOI_SHELL_FOREGROUND=0 + typeset -g POWERLEVEL9K_CHEZMOI_SHELL_BACKGROUND=4 # Custom icon. # typeset -g POWERLEVEL9K_CHEZMOI_SHELL_VISUAL_IDENTIFIER_EXPANSION='⭐' ##################################[ disk_usage: disk usage ]################################## # Colors for different levels of disk usage. - typeset -g POWERLEVEL9K_DISK_USAGE_NORMAL_FOREGROUND=2 - typeset -g POWERLEVEL9K_DISK_USAGE_WARNING_FOREGROUND=3 - typeset -g POWERLEVEL9K_DISK_USAGE_CRITICAL_FOREGROUND=1 + typeset -g POWERLEVEL9K_DISK_USAGE_NORMAL_FOREGROUND=3 + typeset -g POWERLEVEL9K_DISK_USAGE_NORMAL_BACKGROUND=0 + typeset -g POWERLEVEL9K_DISK_USAGE_WARNING_FOREGROUND=0 + typeset -g POWERLEVEL9K_DISK_USAGE_WARNING_BACKGROUND=3 + typeset -g POWERLEVEL9K_DISK_USAGE_CRITICAL_FOREGROUND=7 + typeset -g POWERLEVEL9K_DISK_USAGE_CRITICAL_BACKGROUND=1 # Thresholds for different levels of disk usage (percentage points). typeset -g POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL=90 typeset -g POWERLEVEL9K_DISK_USAGE_CRITICAL_LEVEL=95 @@ -793,15 +827,33 @@ # Custom icon. # typeset -g POWERLEVEL9K_DISK_USAGE_VISUAL_IDENTIFIER_EXPANSION='⭐' + ###########[ vi_mode: vi mode (you don't need this if you've enabled prompt_char) ]########### + # Foreground color. + typeset -g POWERLEVEL9K_VI_MODE_FOREGROUND=0 + # Text and color for normal (a.k.a. command) vi mode. + typeset -g POWERLEVEL9K_VI_COMMAND_MODE_STRING=NORMAL + typeset -g POWERLEVEL9K_VI_MODE_NORMAL_BACKGROUND=2 + # Text and color for visual vi mode. + typeset -g POWERLEVEL9K_VI_VISUAL_MODE_STRING=VISUAL + typeset -g POWERLEVEL9K_VI_MODE_VISUAL_BACKGROUND=4 + # Text and color for overtype (a.k.a. overwrite and replace) vi mode. + typeset -g POWERLEVEL9K_VI_OVERWRITE_MODE_STRING=OVERTYPE + typeset -g POWERLEVEL9K_VI_MODE_OVERWRITE_BACKGROUND=3 + # Text and color for insert vi mode. + typeset -g POWERLEVEL9K_VI_INSERT_MODE_STRING= + typeset -g POWERLEVEL9K_VI_MODE_INSERT_FOREGROUND=8 + ######################################[ ram: free RAM ]####################################### # RAM color. - typeset -g POWERLEVEL9K_RAM_FOREGROUND=2 + typeset -g POWERLEVEL9K_RAM_FOREGROUND=0 + typeset -g POWERLEVEL9K_RAM_BACKGROUND=3 # Custom icon. # typeset -g POWERLEVEL9K_RAM_VISUAL_IDENTIFIER_EXPANSION='⭐' #####################################[ swap: used swap ]###################################### # Swap color. - typeset -g POWERLEVEL9K_SWAP_FOREGROUND=3 + typeset -g POWERLEVEL9K_SWAP_FOREGROUND=0 + typeset -g POWERLEVEL9K_SWAP_BACKGROUND=3 # Custom icon. # typeset -g POWERLEVEL9K_SWAP_VISUAL_IDENTIFIER_EXPANSION='⭐' @@ -809,17 +861,21 @@ # Show average CPU load over this many last minutes. Valid values are 1, 5 and 15. typeset -g POWERLEVEL9K_LOAD_WHICH=5 # Load color when load is under 50%. - typeset -g POWERLEVEL9K_LOAD_NORMAL_FOREGROUND=2 + typeset -g POWERLEVEL9K_LOAD_NORMAL_FOREGROUND=0 + typeset -g POWERLEVEL9K_LOAD_NORMAL_BACKGROUND=2 # Load color when load is between 50% and 70%. - typeset -g POWERLEVEL9K_LOAD_WARNING_FOREGROUND=3 + typeset -g POWERLEVEL9K_LOAD_WARNING_FOREGROUND=0 + typeset -g POWERLEVEL9K_LOAD_WARNING_BACKGROUND=3 # Load color when load is over 70%. - typeset -g POWERLEVEL9K_LOAD_CRITICAL_FOREGROUND=1 + typeset -g POWERLEVEL9K_LOAD_CRITICAL_FOREGROUND=0 + typeset -g POWERLEVEL9K_LOAD_CRITICAL_BACKGROUND=1 # Custom icon. # typeset -g POWERLEVEL9K_LOAD_VISUAL_IDENTIFIER_EXPANSION='⭐' ################[ todo: todo items (https://github.com/todotxt/todo.txt-cli) ]################ # Todo color. - typeset -g POWERLEVEL9K_TODO_FOREGROUND=4 + typeset -g POWERLEVEL9K_TODO_FOREGROUND=0 + typeset -g POWERLEVEL9K_TODO_BACKGROUND=8 # Hide todo when the total number of tasks is zero. typeset -g POWERLEVEL9K_TODO_HIDE_ZERO_TOTAL=true # Hide todo when the number of tasks after filtering is zero. @@ -843,7 +899,9 @@ ###########[ timewarrior: timewarrior tracking status (https://timewarrior.net/) ]############ # Timewarrior color. - typeset -g POWERLEVEL9K_TIMEWARRIOR_FOREGROUND=4 + typeset -g POWERLEVEL9K_TIMEWARRIOR_FOREGROUND=255 + typeset -g POWERLEVEL9K_TIMEWARRIOR_BACKGROUND=8 + # If the tracked task is longer than 24 characters, truncate and append "…". # Tip: To always display tasks without truncation, delete the following parameter. # Tip: To hide task names and display just the icon when time tracking is enabled, set the @@ -855,7 +913,8 @@ ##############[ taskwarrior: taskwarrior task count (https://taskwarrior.org/) ]############## # Taskwarrior color. - typeset -g POWERLEVEL9K_TASKWARRIOR_FOREGROUND=6 + typeset -g POWERLEVEL9K_TASKWARRIOR_FOREGROUND=0 + typeset -g POWERLEVEL9K_TASKWARRIOR_BACKGROUND=6 # Taskwarrior segment format. The following parameters are available within the expansion. # @@ -875,8 +934,10 @@ ######[ per_directory_history: Oh My Zsh per-directory-history local/global indicator ]####### # Color when using local/global history. - typeset -g POWERLEVEL9K_PER_DIRECTORY_HISTORY_LOCAL_FOREGROUND=5 - typeset -g POWERLEVEL9K_PER_DIRECTORY_HISTORY_GLOBAL_FOREGROUND=3 + typeset -g POWERLEVEL9K_PER_DIRECTORY_HISTORY_LOCAL_FOREGROUND=0 + typeset -g POWERLEVEL9K_PER_DIRECTORY_HISTORY_LOCAL_BACKGROUND=5 + typeset -g POWERLEVEL9K_PER_DIRECTORY_HISTORY_GLOBAL_FOREGROUND=0 + typeset -g POWERLEVEL9K_PER_DIRECTORY_HISTORY_GLOBAL_BACKGROUND=3 # Tip: Uncomment the next two lines to hide "local"/"global" text and leave just the icon. # typeset -g POWERLEVEL9K_PER_DIRECTORY_HISTORY_LOCAL_CONTENT_EXPANSION='' @@ -888,7 +949,8 @@ ################################[ cpu_arch: CPU architecture ]################################ # CPU architecture color. - typeset -g POWERLEVEL9K_CPU_ARCH_FOREGROUND=3 + typeset -g POWERLEVEL9K_CPU_ARCH_FOREGROUND=0 + typeset -g POWERLEVEL9K_CPU_ARCH_BACKGROUND=3 # Hide the segment when on a specific CPU architecture. # typeset -g POWERLEVEL9K_CPU_ARCH_X86_64_CONTENT_EXPANSION= @@ -900,13 +962,16 @@ ##################################[ context: user@hostname ]################################## # Context color when running with privileges. typeset -g POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=1 + typeset -g POWERLEVEL9K_CONTEXT_ROOT_BACKGROUND=0 # Context color in SSH without privileges. - typeset -g POWERLEVEL9K_CONTEXT_{REMOTE,REMOTE_SUDO}_FOREGROUND=7 + typeset -g POWERLEVEL9K_CONTEXT_{REMOTE,REMOTE_SUDO}_FOREGROUND=3 + typeset -g POWERLEVEL9K_CONTEXT_{REMOTE,REMOTE_SUDO}_BACKGROUND=0 # Default context color (no privileges, no SSH). - typeset -g POWERLEVEL9K_CONTEXT_FOREGROUND=7 + typeset -g POWERLEVEL9K_CONTEXT_FOREGROUND=3 + typeset -g POWERLEVEL9K_CONTEXT_BACKGROUND=0 - # Context format when running with privileges: bold user@hostname. - typeset -g POWERLEVEL9K_CONTEXT_ROOT_TEMPLATE='%B%n@%m' + # Context format when running with privileges: user@hostname. + typeset -g POWERLEVEL9K_CONTEXT_ROOT_TEMPLATE='%n@%m' # Context format when in SSH without privileges: user@hostname. typeset -g POWERLEVEL9K_CONTEXT_{REMOTE,REMOTE_SUDO}_TEMPLATE='%n@%m' # Default context format (no privileges, no SSH): user@hostname. @@ -919,11 +984,12 @@ # Custom icon. # typeset -g POWERLEVEL9K_CONTEXT_VISUAL_IDENTIFIER_EXPANSION='⭐' # Custom prefix. - typeset -g POWERLEVEL9K_CONTEXT_PREFIX='%fwith ' + typeset -g POWERLEVEL9K_CONTEXT_PREFIX='with ' ###[ virtualenv: python virtual environment (https://docs.python.org/3/library/venv.html) ]### # Python virtual environment color. - typeset -g POWERLEVEL9K_VIRTUALENV_FOREGROUND=6 + typeset -g POWERLEVEL9K_VIRTUALENV_FOREGROUND=0 + typeset -g POWERLEVEL9K_VIRTUALENV_BACKGROUND=4 # Don't show Python version next to the virtual environment name. typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION=false # If set to "false", won't show virtualenv if pyenv is already shown. @@ -936,7 +1002,8 @@ #####################[ anaconda: conda environment (https://conda.io/) ]###################### # Anaconda environment color. - typeset -g POWERLEVEL9K_ANACONDA_FOREGROUND=6 + typeset -g POWERLEVEL9K_ANACONDA_FOREGROUND=0 + typeset -g POWERLEVEL9K_ANACONDA_BACKGROUND=4 # Anaconda segment format. The following parameters are available within the expansion. # @@ -969,7 +1036,8 @@ ################[ pyenv: python environment (https://github.com/pyenv/pyenv) ]################ # Pyenv color. - typeset -g POWERLEVEL9K_PYENV_FOREGROUND=6 + typeset -g POWERLEVEL9K_PYENV_FOREGROUND=0 + typeset -g POWERLEVEL9K_PYENV_BACKGROUND=4 # Hide python version if it doesn't come from one of these sources. typeset -g POWERLEVEL9K_PYENV_SOURCES=(shell local global) # If set to false, hide python version if it's the same as global: @@ -995,7 +1063,8 @@ ################[ goenv: go environment (https://github.com/syndbg/goenv) ]################ # Goenv color. - typeset -g POWERLEVEL9K_GOENV_FOREGROUND=6 + typeset -g POWERLEVEL9K_GOENV_FOREGROUND=0 + typeset -g POWERLEVEL9K_GOENV_BACKGROUND=4 # Hide go version if it doesn't come from one of these sources. typeset -g POWERLEVEL9K_GOENV_SOURCES=(shell local global) # If set to false, hide go version if it's the same as global: @@ -1009,6 +1078,7 @@ ##########[ nodenv: node.js version from nodenv (https://github.com/nodenv/nodenv) ]########## # Nodenv color. typeset -g POWERLEVEL9K_NODENV_FOREGROUND=2 + typeset -g POWERLEVEL9K_NODENV_BACKGROUND=0 # Hide node version if it doesn't come from one of these sources. typeset -g POWERLEVEL9K_NODENV_SOURCES=(shell local global) # If set to false, hide node version if it's the same as global: @@ -1021,7 +1091,8 @@ ##############[ nvm: node.js version from nvm (https://github.com/nvm-sh/nvm) ]############### # Nvm color. - typeset -g POWERLEVEL9K_NVM_FOREGROUND=2 + typeset -g POWERLEVEL9K_NVM_FOREGROUND=0 + typeset -g POWERLEVEL9K_NVM_BACKGROUND=5 # If set to false, hide node version if it's the same as default: # $(nvm version current) == $(nvm version default). typeset -g POWERLEVEL9K_NVM_PROMPT_ALWAYS_SHOW=false @@ -1033,6 +1104,7 @@ ############[ nodeenv: node.js environment (https://github.com/ekalinin/nodeenv) ]############ # Nodeenv color. typeset -g POWERLEVEL9K_NODEENV_FOREGROUND=2 + typeset -g POWERLEVEL9K_NODEENV_BACKGROUND=0 # Don't show Node version next to the environment name. typeset -g POWERLEVEL9K_NODEENV_SHOW_NODE_VERSION=false # Separate environment name from Node version only with a space. @@ -1042,7 +1114,8 @@ ##############################[ node_version: node.js version ]############################### # Node version color. - typeset -g POWERLEVEL9K_NODE_VERSION_FOREGROUND=2 + typeset -g POWERLEVEL9K_NODE_VERSION_FOREGROUND=7 + typeset -g POWERLEVEL9K_NODE_VERSION_BACKGROUND=2 # Show node version only when in a directory tree containing package.json. typeset -g POWERLEVEL9K_NODE_VERSION_PROJECT_ONLY=true # Custom icon. @@ -1050,7 +1123,8 @@ #######################[ go_version: go version (https://golang.org) ]######################## # Go version color. - typeset -g POWERLEVEL9K_GO_VERSION_FOREGROUND=6 + typeset -g POWERLEVEL9K_GO_VERSION_FOREGROUND=255 + typeset -g POWERLEVEL9K_GO_VERSION_BACKGROUND=2 # Show go version only when in a go project subdirectory. typeset -g POWERLEVEL9K_GO_VERSION_PROJECT_ONLY=true # Custom icon. @@ -1058,7 +1132,8 @@ #################[ rust_version: rustc version (https://www.rust-lang.org) ]################## # Rust version color. - typeset -g POWERLEVEL9K_RUST_VERSION_FOREGROUND=4 + typeset -g POWERLEVEL9K_RUST_VERSION_FOREGROUND=0 + typeset -g POWERLEVEL9K_RUST_VERSION_BACKGROUND=208 # Show rust version only when in a rust project subdirectory. typeset -g POWERLEVEL9K_RUST_VERSION_PROJECT_ONLY=true # Custom icon. @@ -1066,7 +1141,8 @@ ###############[ dotnet_version: .NET version (https://dotnet.microsoft.com) ]################ # .NET version color. - typeset -g POWERLEVEL9K_DOTNET_VERSION_FOREGROUND=5 + typeset -g POWERLEVEL9K_DOTNET_VERSION_FOREGROUND=7 + typeset -g POWERLEVEL9K_DOTNET_VERSION_BACKGROUND=5 # Show .NET version only when in a .NET project subdirectory. typeset -g POWERLEVEL9K_DOTNET_VERSION_PROJECT_ONLY=true # Custom icon. @@ -1074,7 +1150,8 @@ #####################[ php_version: php version (https://www.php.net/) ]###################### # PHP version color. - typeset -g POWERLEVEL9K_PHP_VERSION_FOREGROUND=5 + typeset -g POWERLEVEL9K_PHP_VERSION_FOREGROUND=0 + typeset -g POWERLEVEL9K_PHP_VERSION_BACKGROUND=5 # Show PHP version only when in a PHP project subdirectory. typeset -g POWERLEVEL9K_PHP_VERSION_PROJECT_ONLY=true # Custom icon. @@ -1083,12 +1160,28 @@ ##########[ laravel_version: laravel php framework version (https://laravel.com/) ]########### # Laravel version color. typeset -g POWERLEVEL9K_LARAVEL_VERSION_FOREGROUND=1 + typeset -g POWERLEVEL9K_LARAVEL_VERSION_BACKGROUND=7 # Custom icon. # typeset -g POWERLEVEL9K_LARAVEL_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' + #############[ rbenv: ruby version from rbenv (https://github.com/rbenv/rbenv) ]############## + # Rbenv color. + typeset -g POWERLEVEL9K_RBENV_FOREGROUND=0 + typeset -g POWERLEVEL9K_RBENV_BACKGROUND=1 + # Hide ruby version if it doesn't come from one of these sources. + typeset -g POWERLEVEL9K_RBENV_SOURCES=(shell local global) + # If set to false, hide ruby version if it's the same as global: + # $(rbenv version-name) == $(rbenv global). + typeset -g POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW=false + # If set to false, hide ruby version if it's equal to "system". + typeset -g POWERLEVEL9K_RBENV_SHOW_SYSTEM=true + # Custom icon. + # typeset -g POWERLEVEL9K_RBENV_VISUAL_IDENTIFIER_EXPANSION='⭐' + ####################[ java_version: java version (https://www.java.com/) ]#################### # Java version color. - typeset -g POWERLEVEL9K_JAVA_VERSION_FOREGROUND=4 + typeset -g POWERLEVEL9K_JAVA_VERSION_FOREGROUND=1 + typeset -g POWERLEVEL9K_JAVA_VERSION_BACKGROUND=7 # Show java version only when in a java project subdirectory. typeset -g POWERLEVEL9K_JAVA_VERSION_PROJECT_ONLY=true # Show brief version. @@ -1098,32 +1191,23 @@ ###[ package: name@version from package.json (https://docs.npmjs.com/files/package.json) ]#### # Package color. - typeset -g POWERLEVEL9K_PACKAGE_FOREGROUND=6 + typeset -g POWERLEVEL9K_PACKAGE_FOREGROUND=0 + typeset -g POWERLEVEL9K_PACKAGE_BACKGROUND=6 + # Package format. The following parameters are available within the expansion. # # - P9K_PACKAGE_NAME The value of `name` field in package.json. # - P9K_PACKAGE_VERSION The value of `version` field in package.json. # # typeset -g POWERLEVEL9K_PACKAGE_CONTENT_EXPANSION='${P9K_PACKAGE_NAME//\%/%%}@${P9K_PACKAGE_VERSION//\%/%%}' - # Custom icon. - # typeset -g POWERLEVEL9K_PACKAGE_VISUAL_IDENTIFIER_EXPANSION='⭐' - #############[ rbenv: ruby version from rbenv (https://github.com/rbenv/rbenv) ]############## - # Rbenv color. - typeset -g POWERLEVEL9K_RBENV_FOREGROUND=1 - # Hide ruby version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_RBENV_SOURCES=(shell local global) - # If set to false, hide ruby version if it's the same as global: - # $(rbenv version-name) == $(rbenv global). - typeset -g POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide ruby version if it's equal to "system". - typeset -g POWERLEVEL9K_RBENV_SHOW_SYSTEM=true # Custom icon. - # typeset -g POWERLEVEL9K_RBENV_VISUAL_IDENTIFIER_EXPANSION='⭐' + # typeset -g POWERLEVEL9K_PACKAGE_VISUAL_IDENTIFIER_EXPANSION='⭐' #######################[ rvm: ruby version from rvm (https://rvm.io) ]######################## # Rvm color. - typeset -g POWERLEVEL9K_RVM_FOREGROUND=1 + typeset -g POWERLEVEL9K_RVM_FOREGROUND=0 + typeset -g POWERLEVEL9K_RVM_BACKGROUND=240 # Don't show @gemset at the end. typeset -g POWERLEVEL9K_RVM_SHOW_GEMSET=false # Don't show ruby- at the front. @@ -1133,13 +1217,15 @@ ###########[ fvm: flutter version management (https://github.com/leoafarias/fvm) ]############ # Fvm color. - typeset -g POWERLEVEL9K_FVM_FOREGROUND=4 + typeset -g POWERLEVEL9K_FVM_FOREGROUND=0 + typeset -g POWERLEVEL9K_FVM_BACKGROUND=4 # Custom icon. # typeset -g POWERLEVEL9K_FVM_VISUAL_IDENTIFIER_EXPANSION='⭐' ##########[ luaenv: lua version from luaenv (https://github.com/cehoffman/luaenv) ]########### # Lua color. - typeset -g POWERLEVEL9K_LUAENV_FOREGROUND=4 + typeset -g POWERLEVEL9K_LUAENV_FOREGROUND=0 + typeset -g POWERLEVEL9K_LUAENV_BACKGROUND=4 # Hide lua version if it doesn't come from one of these sources. typeset -g POWERLEVEL9K_LUAENV_SOURCES=(shell local global) # If set to false, hide lua version if it's the same as global: @@ -1152,7 +1238,8 @@ ###############[ jenv: java version from jenv (https://github.com/jenv/jenv) ]################ # Java color. - typeset -g POWERLEVEL9K_JENV_FOREGROUND=4 + typeset -g POWERLEVEL9K_JENV_FOREGROUND=1 + typeset -g POWERLEVEL9K_JENV_BACKGROUND=7 # Hide java version if it doesn't come from one of these sources. typeset -g POWERLEVEL9K_JENV_SOURCES=(shell local global) # If set to false, hide java version if it's the same as global: @@ -1165,7 +1252,8 @@ ###########[ plenv: perl version from plenv (https://github.com/tokuhirom/plenv) ]############ # Perl color. - typeset -g POWERLEVEL9K_PLENV_FOREGROUND=6 + typeset -g POWERLEVEL9K_PLENV_FOREGROUND=0 + typeset -g POWERLEVEL9K_PLENV_BACKGROUND=4 # Hide perl version if it doesn't come from one of these sources. typeset -g POWERLEVEL9K_PLENV_SOURCES=(shell local global) # If set to false, hide perl version if it's the same as global: @@ -1188,20 +1276,22 @@ ############[ phpenv: php version from phpenv (https://github.com/phpenv/phpenv) ]############ # PHP color. - typeset -g POWERLEVEL9K_PHPENV_FOREGROUND=5 + typeset -g POWERLEVEL9K_PHPENV_FOREGROUND=0 + typeset -g POWERLEVEL9K_PHPENV_BACKGROUND=5 # Hide php version if it doesn't come from one of these sources. typeset -g POWERLEVEL9K_PHPENV_SOURCES=(shell local global) # If set to false, hide php version if it's the same as global: # $(phpenv version-name) == $(phpenv global). typeset -g POWERLEVEL9K_PHPENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide php version if it's equal to "system". + # If set to false, hide PHP version if it's equal to "system". typeset -g POWERLEVEL9K_PHPENV_SHOW_SYSTEM=true # Custom icon. # typeset -g POWERLEVEL9K_PHPENV_VISUAL_IDENTIFIER_EXPANSION='⭐' #######[ scalaenv: scala version from scalaenv (https://github.com/scalaenv/scalaenv) ]####### # Scala color. - typeset -g POWERLEVEL9K_SCALAENV_FOREGROUND=1 + typeset -g POWERLEVEL9K_SCALAENV_FOREGROUND=0 + typeset -g POWERLEVEL9K_SCALAENV_BACKGROUND=1 # Hide scala version if it doesn't come from one of these sources. typeset -g POWERLEVEL9K_SCALAENV_SOURCES=(shell local global) # If set to false, hide scala version if it's the same as global: @@ -1214,7 +1304,9 @@ ##########[ haskell_stack: haskell version from stack (https://haskellstack.org/) ]########### # Haskell color. - typeset -g POWERLEVEL9K_HASKELL_STACK_FOREGROUND=3 + typeset -g POWERLEVEL9K_HASKELL_STACK_FOREGROUND=0 + typeset -g POWERLEVEL9K_HASKELL_STACK_BACKGROUND=3 + # Hide haskell version if it doesn't come from one of these sources. # # shell: version is set by STACK_YAML @@ -1226,6 +1318,51 @@ # Custom icon. # typeset -g POWERLEVEL9K_HASKELL_STACK_VISUAL_IDENTIFIER_EXPANSION='⭐' + ################[ terraform: terraform workspace (https://www.terraform.io) ]################# + # Don't show terraform workspace if it's literally "default". + typeset -g POWERLEVEL9K_TERRAFORM_SHOW_DEFAULT=false + # POWERLEVEL9K_TERRAFORM_CLASSES is an array with even number of elements. The first element + # in each pair defines a pattern against which the current terraform workspace gets matched. + # More specifically, it's P9K_CONTENT prior to the application of context expansion (see below) + # that gets matched. If you unset all POWERLEVEL9K_TERRAFORM_*CONTENT_EXPANSION parameters, + # you'll see this value in your prompt. The second element of each pair in + # POWERLEVEL9K_TERRAFORM_CLASSES defines the workspace class. Patterns are tried in order. The + # first match wins. + # + # For example, given these settings: + # + # typeset -g POWERLEVEL9K_TERRAFORM_CLASSES=( + # '*prod*' PROD + # '*test*' TEST + # '*' OTHER) + # + # If your current terraform workspace is "project_test", its class is TEST because "project_test" + # doesn't match the pattern '*prod*' but does match '*test*'. + # + # You can define different colors, icons and content expansions for different classes: + # + # typeset -g POWERLEVEL9K_TERRAFORM_TEST_FOREGROUND=2 + # typeset -g POWERLEVEL9K_TERRAFORM_TEST_BACKGROUND=0 + # typeset -g POWERLEVEL9K_TERRAFORM_TEST_VISUAL_IDENTIFIER_EXPANSION='⭐' + # typeset -g POWERLEVEL9K_TERRAFORM_TEST_CONTENT_EXPANSION='> ${P9K_CONTENT} <' + typeset -g POWERLEVEL9K_TERRAFORM_CLASSES=( + # '*prod*' PROD # These values are examples that are unlikely + # '*test*' TEST # to match your needs. Customize them as needed. + '*' OTHER) + typeset -g POWERLEVEL9K_TERRAFORM_OTHER_FOREGROUND=4 + typeset -g POWERLEVEL9K_TERRAFORM_OTHER_BACKGROUND=0 + # typeset -g POWERLEVEL9K_TERRAFORM_OTHER_VISUAL_IDENTIFIER_EXPANSION='⭐' + + #############[ terraform_version: terraform version (https://www.terraform.io) ]############## + # Terraform version color. + typeset -g POWERLEVEL9K_TERRAFORM_VERSION_FOREGROUND=4 + typeset -g POWERLEVEL9K_TERRAFORM_VERSION_BACKGROUND=0 + # Custom icon. + # typeset -g POWERLEVEL9K_TERRAFORM_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' + + ################[ terraform_version: It shows active terraform version (https://www.terraform.io) ]################# + typeset -g POWERLEVEL9K_TERRAFORM_VERSION_SHOW_ON_COMMAND='terraform|tf' + #############[ kubecontext: current kubernetes context (https://kubernetes.io/) ]############# # Show kubecontext only when the command you are typing invokes one of these tools. # Tip: Remove the next line to always show kubecontext. @@ -1254,15 +1391,17 @@ # # You can define different colors, icons and content expansions for different classes: # - # typeset -g POWERLEVEL9K_KUBECONTEXT_TEST_FOREGROUND=3 + # typeset -g POWERLEVEL9K_KUBECONTEXT_TEST_FOREGROUND=0 + # typeset -g POWERLEVEL9K_KUBECONTEXT_TEST_BACKGROUND=2 # typeset -g POWERLEVEL9K_KUBECONTEXT_TEST_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_KUBECONTEXT_TEST_CONTENT_EXPANSION='> ${P9K_CONTENT} <' typeset -g POWERLEVEL9K_KUBECONTEXT_CLASSES=( # '*prod*' PROD # These values are examples that are unlikely # '*test*' TEST # to match your needs. Customize them as needed. '*' DEFAULT) - typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_FOREGROUND=5 - # typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_VISUAL_IDENTIFIER_EXPANSION='⭐' + typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_FOREGROUND=7 + typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_BACKGROUND=5 + typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_VISUAL_IDENTIFIER_EXPANSION='○' # Use POWERLEVEL9K_KUBECONTEXT_CONTENT_EXPANSION to specify the content displayed by kubecontext # segment. Parameter expansions are very flexible and fast, too. See reference: @@ -1311,46 +1450,7 @@ POWERLEVEL9K_KUBECONTEXT_DEFAULT_CONTENT_EXPANSION+='${${:-/$P9K_KUBECONTEXT_NAMESPACE}:#/default}' # Custom prefix. - typeset -g POWERLEVEL9K_KUBECONTEXT_PREFIX='%fat ' - - ################[ terraform: terraform workspace (https://www.terraform.io) ]################# - # Don't show terraform workspace if it's literally "default". - typeset -g POWERLEVEL9K_TERRAFORM_SHOW_DEFAULT=false - # POWERLEVEL9K_TERRAFORM_CLASSES is an array with even number of elements. The first element - # in each pair defines a pattern against which the current terraform workspace gets matched. - # More specifically, it's P9K_CONTENT prior to the application of context expansion (see below) - # that gets matched. If you unset all POWERLEVEL9K_TERRAFORM_*CONTENT_EXPANSION parameters, - # you'll see this value in your prompt. The second element of each pair in - # POWERLEVEL9K_TERRAFORM_CLASSES defines the workspace class. Patterns are tried in order. The - # first match wins. - # - # For example, given these settings: - # - # typeset -g POWERLEVEL9K_TERRAFORM_CLASSES=( - # '*prod*' PROD - # '*test*' TEST - # '*' OTHER) - # - # If your current terraform workspace is "project_test", its class is TEST because "project_test" - # doesn't match the pattern '*prod*' but does match '*test*'. - # - # You can define different colors, icons and content expansions for different classes: - # - # typeset -g POWERLEVEL9K_TERRAFORM_TEST_FOREGROUND=2 - # typeset -g POWERLEVEL9K_TERRAFORM_TEST_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_TERRAFORM_TEST_CONTENT_EXPANSION='> ${P9K_CONTENT} <' - typeset -g POWERLEVEL9K_TERRAFORM_CLASSES=( - # '*prod*' PROD # These values are examples that are unlikely - # '*test*' TEST # to match your needs. Customize them as needed. - '*' OTHER) - typeset -g POWERLEVEL9K_TERRAFORM_OTHER_FOREGROUND=4 - # typeset -g POWERLEVEL9K_TERRAFORM_OTHER_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #############[ terraform_version: terraform version (https://www.terraform.io) ]############## - # Terraform version color. - typeset -g POWERLEVEL9K_TERRAFORM_VERSION_FOREGROUND=4 - # Custom icon. - # typeset -g POWERLEVEL9K_TERRAFORM_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' + typeset -g POWERLEVEL9K_KUBECONTEXT_PREFIX='at ' #[ aws: aws profile (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) ]# # Show aws only when the command you are typing invokes one of these tools. @@ -1377,14 +1477,15 @@ # # You can define different colors, icons and content expansions for different classes: # - # typeset -g POWERLEVEL9K_AWS_TEST_FOREGROUND=2 + # typeset -g POWERLEVEL9K_AWS_TEST_FOREGROUND=28 # typeset -g POWERLEVEL9K_AWS_TEST_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_AWS_TEST_CONTENT_EXPANSION='> ${P9K_CONTENT} <' typeset -g POWERLEVEL9K_AWS_CLASSES=( # '*prod*' PROD # These values are examples that are unlikely # '*test*' TEST # to match your needs. Customize them as needed. '*' DEFAULT) - typeset -g POWERLEVEL9K_AWS_DEFAULT_FOREGROUND=3 + typeset -g POWERLEVEL9K_AWS_DEFAULT_FOREGROUND=7 + typeset -g POWERLEVEL9K_AWS_DEFAULT_BACKGROUND=1 # typeset -g POWERLEVEL9K_AWS_DEFAULT_VISUAL_IDENTIFIER_EXPANSION='⭐' # AWS segment format. The following parameters are available within the expansion. @@ -1396,8 +1497,9 @@ #[ aws_eb_env: aws elastic beanstalk environment (https://aws.amazon.com/elasticbeanstalk/) ]# # AWS Elastic Beanstalk environment color. typeset -g POWERLEVEL9K_AWS_EB_ENV_FOREGROUND=2 + typeset -g POWERLEVEL9K_AWS_EB_ENV_BACKGROUND=0 # Custom icon. - # typeset -g POWERLEVEL9K_AWS_EB_ENV_VISUAL_IDENTIFIER_EXPANSION='⭐' + typeset -g POWERLEVEL9K_AWS_EB_ENV_VISUAL_IDENTIFIER_EXPANSION='eb' ##########[ azure: azure account name (https://docs.microsoft.com/en-us/cli/azure) ]########## # Show azure only when the command you are typing invokes one of these tools. @@ -1425,6 +1527,7 @@ # You can define different colors, icons and content expansions for different classes: # # typeset -g POWERLEVEL9K_AZURE_TEST_FOREGROUND=2 + # typeset -g POWERLEVEL9K_AZURE_TEST_BACKGROUND=0 # typeset -g POWERLEVEL9K_AZURE_TEST_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_AZURE_TEST_CONTENT_EXPANSION='> ${P9K_CONTENT} <' typeset -g POWERLEVEL9K_AZURE_CLASSES=( @@ -1433,7 +1536,8 @@ '*' OTHER) # Azure account name color. - typeset -g POWERLEVEL9K_AZURE_OTHER_FOREGROUND=4 + typeset -g POWERLEVEL9K_AZURE_OTHER_FOREGROUND=7 + typeset -g POWERLEVEL9K_AZURE_OTHER_BACKGROUND=4 # Custom icon. # typeset -g POWERLEVEL9K_AZURE_OTHER_VISUAL_IDENTIFIER_EXPANSION='⭐' @@ -1442,7 +1546,8 @@ # Tip: Remove the next line to always show gcloud. typeset -g POWERLEVEL9K_GCLOUD_SHOW_ON_COMMAND='gcloud|gcs|gsutil' # Google cloud color. - typeset -g POWERLEVEL9K_GCLOUD_FOREGROUND=4 + typeset -g POWERLEVEL9K_GCLOUD_FOREGROUND=7 + typeset -g POWERLEVEL9K_GCLOUD_BACKGROUND=4 # Google cloud format. Change the value of POWERLEVEL9K_GCLOUD_PARTIAL_CONTENT_EXPANSION and/or # POWERLEVEL9K_GCLOUD_COMPLETE_CONTENT_EXPANSION if the default is too verbose or not informative @@ -1506,14 +1611,15 @@ # # You can define different colors, icons and content expansions for different classes: # - # typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_TEST_FOREGROUND=3 + # typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_TEST_FOREGROUND=28 # typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_TEST_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_TEST_CONTENT_EXPANSION='$P9K_GOOGLE_APP_CRED_PROJECT_ID' typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_CLASSES=( # '*:*prod*:*' PROD # These values are examples that are unlikely # '*:*test*:*' TEST # to match your needs. Customize them as needed. '*' DEFAULT) - typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_DEFAULT_FOREGROUND=5 + typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_DEFAULT_FOREGROUND=7 + typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_DEFAULT_BACKGROUND=4 # typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_DEFAULT_VISUAL_IDENTIFIER_EXPANSION='⭐' # Use POWERLEVEL9K_GOOGLE_APP_CRED_CONTENT_EXPANSION to specify the content displayed by @@ -1534,23 +1640,26 @@ ##############[ toolbox: toolbox name (https://github.com/containers/toolbox) ]############### # Toolbox color. - typeset -g POWERLEVEL9K_TOOLBOX_FOREGROUND=3 + typeset -g POWERLEVEL9K_TOOLBOX_FOREGROUND=0 + typeset -g POWERLEVEL9K_TOOLBOX_BACKGROUND=3 # Don't display the name of the toolbox if it matches fedora-toolbox-*. typeset -g POWERLEVEL9K_TOOLBOX_CONTENT_EXPANSION='${P9K_TOOLBOX_NAME:#fedora-toolbox-*}' # Custom icon. # typeset -g POWERLEVEL9K_TOOLBOX_VISUAL_IDENTIFIER_EXPANSION='⭐' # Custom prefix. - typeset -g POWERLEVEL9K_TOOLBOX_PREFIX='%fin ' + typeset -g POWERLEVEL9K_TOOLBOX_PREFIX='in ' ###############################[ public_ip: public IP address ]############################### # Public IP color. - typeset -g POWERLEVEL9K_PUBLIC_IP_FOREGROUND=6 + typeset -g POWERLEVEL9K_PUBLIC_IP_FOREGROUND=7 + typeset -g POWERLEVEL9K_PUBLIC_IP_BACKGROUND=0 # Custom icon. # typeset -g POWERLEVEL9K_PUBLIC_IP_VISUAL_IDENTIFIER_EXPANSION='⭐' ########################[ vpn_ip: virtual private network indicator ]######################### # VPN IP color. - typeset -g POWERLEVEL9K_VPN_IP_FOREGROUND=3 + typeset -g POWERLEVEL9K_VPN_IP_FOREGROUND=0 + typeset -g POWERLEVEL9K_VPN_IP_BACKGROUND=6 # When on VPN, show just an icon without the IP address. # Tip: To display the private IP address when on VPN, remove the next line. typeset -g POWERLEVEL9K_VPN_IP_CONTENT_EXPANSION= @@ -1566,7 +1675,8 @@ ###########[ ip: ip address and bandwidth usage for a specified network interface ]########### # IP color. - typeset -g POWERLEVEL9K_IP_FOREGROUND=4 + typeset -g POWERLEVEL9K_IP_BACKGROUND=4 + typeset -g POWERLEVEL9K_IP_FOREGROUND=0 # The following parameters are accessible within the expansion: # # Parameter | Meaning @@ -1579,7 +1689,7 @@ # P9K_IP_TX_BYTES_DELTA | number of bytes sent since last prompt # P9K_IP_RX_RATE | receive rate (since last prompt) # P9K_IP_TX_RATE | send rate (since last prompt) - typeset -g POWERLEVEL9K_IP_CONTENT_EXPANSION='$P9K_IP_IP${P9K_IP_RX_RATE:+ %2F⇣$P9K_IP_RX_RATE}${P9K_IP_TX_RATE:+ %3F⇡$P9K_IP_TX_RATE}' + typeset -g POWERLEVEL9K_IP_CONTENT_EXPANSION='${P9K_IP_RX_RATE:+⇣$P9K_IP_RX_RATE }${P9K_IP_TX_RATE:+⇡$P9K_IP_TX_RATE }$P9K_IP_IP' # Show information for the first network interface whose name matches this regular expression. # Run `ifconfig` or `ip -4 a show` to see the names of all network interfaces. typeset -g POWERLEVEL9K_IP_INTERFACE='[ew].*' @@ -1588,7 +1698,8 @@ #########################[ proxy: system-wide http/https/ftp proxy ]########################## # Proxy color. - typeset -g POWERLEVEL9K_PROXY_FOREGROUND=2 + typeset -g POWERLEVEL9K_PROXY_FOREGROUND=4 + typeset -g POWERLEVEL9K_PROXY_BACKGROUND=0 # Custom icon. # typeset -g POWERLEVEL9K_PROXY_VISUAL_IDENTIFIER_EXPANSION='⭐' @@ -1601,20 +1712,22 @@ # Show battery in yellow when it's discharging. typeset -g POWERLEVEL9K_BATTERY_DISCONNECTED_FOREGROUND=3 # Battery pictograms going from low to high level of charge. - typeset -g POWERLEVEL9K_BATTERY_STAGES='\uf58d\uf579\uf57a\uf57b\uf57c\uf57d\uf57e\uf57f\uf580\uf581\uf578' + typeset -g POWERLEVEL9K_BATTERY_STAGES=('%K{232}▁' '%K{232}▂' '%K{232}▃' '%K{232}▄' '%K{232}▅' '%K{232}▆' '%K{232}▇' '%K{232}█') # Don't show the remaining time to charge/discharge. typeset -g POWERLEVEL9K_BATTERY_VERBOSE=false + typeset -g POWERLEVEL9K_BATTERY_BACKGROUND=0 #####################################[ wifi: wifi speed ]##################################### # WiFi color. - typeset -g POWERLEVEL9K_WIFI_FOREGROUND=4 + typeset -g POWERLEVEL9K_WIFI_FOREGROUND=0 + typeset -g POWERLEVEL9K_WIFI_BACKGROUND=4 # Custom icon. # typeset -g POWERLEVEL9K_WIFI_VISUAL_IDENTIFIER_EXPANSION='⭐' # Use different colors and icons depending on signal strength ($P9K_WIFI_BARS). # # # Wifi colors and icons for different signal strength levels (low to high). - # typeset -g my_wifi_fg=(4 4 4 4 4) # <-- change these values + # typeset -g my_wifi_fg=(0 0 0 0 0) # <-- change these values # typeset -g my_wifi_icon=('WiFi' 'WiFi' 'WiFi' 'WiFi' 'WiFi') # <-- change these values # # typeset -g POWERLEVEL9K_WIFI_CONTENT_EXPANSION='%F{${my_wifi_fg[P9K_WIFI_BARS+1]}}$P9K_WIFI_LAST_TX_RATE Mbps' @@ -1633,7 +1746,8 @@ ####################################[ time: current time ]#################################### # Current time color. - typeset -g POWERLEVEL9K_TIME_FOREGROUND=6 + typeset -g POWERLEVEL9K_TIME_FOREGROUND=0 + typeset -g POWERLEVEL9K_TIME_BACKGROUND=7 # Format for the current time: 09:51:02. See `man 3 strftime`. typeset -g POWERLEVEL9K_TIME_FORMAT='%D{%H:%M:%S}' # If set to true, time will update when you hit enter. This way prompts for the past @@ -1641,17 +1755,18 @@ # behavior where they contain the end times of their preceding commands. typeset -g POWERLEVEL9K_TIME_UPDATE_ON_COMMAND=false # Custom icon. - # typeset -g POWERLEVEL9K_TIME_VISUAL_IDENTIFIER_EXPANSION='⭐' + typeset -g POWERLEVEL9K_TIME_VISUAL_IDENTIFIER_EXPANSION= # Custom prefix. - typeset -g POWERLEVEL9K_TIME_PREFIX='%fat ' + typeset -g POWERLEVEL9K_TIME_PREFIX='at ' # Example of a user-defined prompt segment. Function prompt_example will be called on every # prompt if `example` prompt segment is added to POWERLEVEL9K_LEFT_PROMPT_ELEMENTS or - # POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS. It displays an icon and green text greeting the user. + # POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS. It displays an icon and yellow text on red background + # greeting the user. # # Type `p10k help segment` for documentation and a more sophisticated example. function prompt_example() { - p10k segment -f 2 -i '⭐' -t 'hello, %n' + p10k segment -b 1 -f 3 -i '⭐' -t 'hello, %n' } # User-defined prompt segments may optionally provide an instant_prompt_* function. Its job @@ -1674,7 +1789,8 @@ } # User-defined prompt segments can be customized the same way as built-in segments. - # typeset -g POWERLEVEL9K_EXAMPLE_FOREGROUND=208 + typeset -g POWERLEVEL9K_EXAMPLE_FOREGROUND=3 + typeset -g POWERLEVEL9K_EXAMPLE_BACKGROUND=1 # typeset -g POWERLEVEL9K_EXAMPLE_VISUAL_IDENTIFIER_EXPANSION='⭐' # Transient prompt works similarly to the builtin transient_rprompt option. It trims down prompt diff --git a/src/requirements.txt b/src/requirements.txt index ee911ff..462dfd6 100644 --- a/src/requirements.txt +++ b/src/requirements.txt @@ -1,4 +1,4 @@ -docker_py==1.10.6 +docker==7.0.0 invoke==2.2.0 pyfiglet==1.0.2 pipreqs==0.4.13 diff --git a/src/tasks.py b/src/tasks.py index f7f5276..a256cb9 100644 --- a/src/tasks.py +++ b/src/tasks.py @@ -47,8 +47,8 @@ def help(c, verbose=0): ascii_banner = pyfiglet.figlet_format("Tool Box") print(ascii_banner) - print("Try running `inv --help` for more information or `inv --list` to see a list of subcommands.") - + print("Try running `inv --help` for more information or `inv --list` to see a list of subcommands. ") + print("Some additional commands that are also installed and might be of use: whois, speedtest, mtr, tcpdump, nmap, nc") @task( help={'name': "Name of the person to say hi to.", @@ -72,15 +72,50 @@ def hello(c, name="world", verbose=0): logger.debug("Said hello.") -@task( - incrementable=['verbose'] - ) +@task(incrementable=['verbose']) +def dockerinfo(c, verbose=0): + """Get Docker installation information + """ + + _set_log_level(verbose) + + logger.debug("Looking for Docker installation...") + + ####TODO: add try/except + client = docker.DockerClient(base_url='unix://var/run/docker.sock') + + info = client.info() + client.close() + + print(f"{'Árchetecture':<20}: {info.get('Architecture')}") + print(f"{'Containers':<20}: {info.get('Containers')}") + print(f"{'Containers Running':<20}: {info.get('ContainersRunning')}") + print(f"{'DockerRootDir':<20}: {info.get('DockerRootDir')}") + print(f"{'HttpProxy':<20}: {info.get('HttpProxy')}") + print(f"{'HttpsProxy':<20}: {info.get('HttpsProxy')}") + print(f"{'Images':<20}: {info.get('Images')}") + print(f"{'KernelVersion':<20}: {info.get('KernelVersion')}") + print(f"{'LoggingDriver':<20}: {info.get('LoggingDriver')}") + print(f"{'Name':<20}: {info.get('Name')}") + print(f"{'NoProxy':<20}: {info.get('NoProxy')}") + print(f"{'OSType':<20}: {info.get('OSType')}") + print(f"{'OperatingSystem':<20}: {info.get('OperatingSystem')}") + print(f"{'ServerVersion':<20}: {info.get('ServerVersion')}") + print(f"{'SystemTime':<20}: {info.get('SystemTime')}") + + from pprint import pprint + #pprint(client.df()) + + +@task(incrementable=['verbose']) def netspeed(c, verbose=0): """Run an internet speedtest """ _set_log_level(verbose) + logger.debug("Checking network speed...") + servers = [] # If you want to test against a specific server # servers = [1234] @@ -99,7 +134,6 @@ def netspeed(c, verbose=0): logger.debug(results_dict) logger.debug(s.results.server) - logger.info(f"PING: {int(s.results.ping)}ms") - logger.info(f"UPLOAD: {int(s.results.upload / 1024 / 1024)}Mbps") - logger.info(f"DOWNLOAD: {int(s.results.download / 1024 / 1024)}Mbps") - \ No newline at end of file + print(f"{'PING':<20}: {int(s.results.ping)}ms") + print(f"{'UPLOAD':<20}: {int(s.results.upload / 1024 / 1024)}Mbps") + print(f"{'DOWNLOAD':<20}: {int(s.results.download / 1024 / 1024)}Mbps") From 127dd24c5765cab6bc205ac6152835143577f50f Mon Sep 17 00:00:00 2001 From: Garth Johnson Date: Fri, 29 Dec 2023 01:54:17 +0000 Subject: [PATCH 06/16] changed from app to dev container name --- .devcontainer/devcontainer.json | 8 ++++---- .devcontainer/docker-compose.yml | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 306a0d7..e7007db 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -6,13 +6,13 @@ // Update the 'dockerComposeFile' list if you have more compose files or use different names. // The .devcontainer/docker-compose.yml file contains any overrides you need/want to make. "dockerComposeFile": [ - "../docker-compose.yml", - "docker-compose.yml" + "../docker-compose.yml", + "docker-compose.yml" ], // The 'service' property is the name of the service for the container that VS Code should // use. Update this value and .devcontainer/docker-compose.yml to the real service name. - "service": "app", + "service": "dev", // The optional 'workspaceFolder' property is the path VS Code should open by default when // connected. This is typically a file mount in .devcontainer/docker-compose.yml @@ -39,7 +39,7 @@ // Use 'forwardPorts' to make a list of ports inside the container available locally. // "forwardPorts": [], - "forwardPorts": [ +"forwardPorts": [ 8000 ] diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index 255dcc9..fc2371c 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -1,9 +1,9 @@ version: '3.8' services: # Update this to the name of the service you want to work with in your docker-compose.yml file - app: - # Uncomment if you want to override the service's Dockerfile to one in the .devcontainer - # folder. Note that the path of the Dockerfile and context is relative to the *primary* + dev: + # Uncomment if you want to override the service's Dockerfile to one in the .devcontainer + # folder. Note that the path of the Dockerfile and context is relative to the *primary* # docker-compose.yml file (the first in the devcontainer.json "dockerComposeFile" # array). The sample below assumes your primary file is in the root of your project. # @@ -24,5 +24,5 @@ services: # Overrides default command so things don't shut down after the process ends. command: /bin/sh -c "while sleep 1000; do :; done" - - network_mode: "host" + +network_mode: "host" From ae00af288ae8000f1b417b17025aea25801dc41e Mon Sep 17 00:00:00 2001 From: Garth Johnson Date: Fri, 29 Dec 2023 02:04:42 +0000 Subject: [PATCH 07/16] fixed indent filure --- .devcontainer/docker-compose.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index fc2371c..fd4e4e9 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -25,4 +25,5 @@ services: # Overrides default command so things don't shut down after the process ends. command: /bin/sh -c "while sleep 1000; do :; done" -network_mode: "host" + # Allow the dev container to use the same network as the host + network_mode: "host" From 41e6be4e21138b268d874872f22f2756e3480408 Mon Sep 17 00:00:00 2001 From: Garth Johnson Date: Fri, 29 Dec 2023 02:45:26 +0000 Subject: [PATCH 08/16] indenting --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index e7007db..02eedd2 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -39,7 +39,7 @@ // Use 'forwardPorts' to make a list of ports inside the container available locally. // "forwardPorts": [], -"forwardPorts": [ + "forwardPorts": [ 8000 ] From 81010f7b446fe8d171ba4d776812c27b6c25d2b5 Mon Sep 17 00:00:00 2001 From: Garth Johnson Date: Fri, 29 Dec 2023 07:00:36 +0000 Subject: [PATCH 09/16] versioning test --- .github/workflows/docker-publish-dh.yml | 4 ++++ .github/workflows/docker-publish.yml | 4 ++++ Dockerfile | 14 +++++++++++++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-publish-dh.yml b/.github/workflows/docker-publish-dh.yml index 7e95967..820e468 100644 --- a/.github/workflows/docker-publish-dh.yml +++ b/.github/workflows/docker-publish-dh.yml @@ -40,3 +40,7 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + build-args: | + GIT_VERSION_TAG=${{ env.RELEASE_VERSION }} + GIT_COMMIT_MESSAGE=${{ github.event.head_commit.message }} + GIT_VERSION_HASH=${{ github.sha }} \ No newline at end of file diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 7983ba8..7f3692f 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -81,6 +81,10 @@ jobs: push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + build-args: | + GIT_VERSION_TAG=${{ env.RELEASE_VERSION }} + GIT_COMMIT_MESSAGE=${{ github.event.head_commit.message }} + GIT_VERSION_HASH=${{ github.sha }} cache-from: type=gha cache-to: type=gha,mode=max diff --git a/Dockerfile b/Dockerfile index 4225674..e4e0d29 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,10 @@ FROM python:3.12-slim-bullseye +# Passed from Github Actions +ARG GIT_VERSION_TAG=unspecified +ARG GIT_COMMIT_MESSAGE=unspecified +ARG GIT_VERSION_HASH=unspecified + # Install updates and docker RUN apt-get -yq update && apt-get -yq install \ curl \ @@ -36,7 +41,7 @@ ADD src/requirements.txt . RUN python3 -m pip install --no-cache-dir -r requirements.txt # Setup a user to match the host and reduce the frustration/confusion of file ownership -ARG USERNAME=netyeti +ARG USERNAME=ubuntu ARG USER_UID=1000 ARG USER_GID=$USER_UID RUN groupadd --gid $USER_GID $USERNAME && groupadd --gid 999 docker \ @@ -45,6 +50,11 @@ RUN groupadd --gid $USER_GID $USERNAME && groupadd --gid 999 docker \ && chmod 0440 /etc/sudoers.d/$USERNAME RUN usermod -aG docker $USERNAME +# You can read these files for the information in your application +RUN echo $GIT_VERSION_TAG > GIT_VERSION_TAG.txt +RUN echo $GIT_COMMIT_MESSAGE > GIT_COMMIT_MESSAGE.txt +RUN echo $GIT_VERSION_HASH > GIT_VERSION_HASH.txt + # Switch to the user now so that file ownership matches USER $USERNAME @@ -78,5 +88,7 @@ ADD --chown=1000:1000 src/.p10k.zsh /home/$USERNAME/.p10k.zsh ADD --chown=1000:1000 --chmod=+x src/tasks.py . ADD --chown=1000:1000 --chmod=+x https://private-sw-downloads.s3.amazonaws.com/archfx_broker/preflight/broker_preflight.sh . +ARG TOOLBOX_VERSION="$(git describe --tags `git rev-list --tags --max-count=1`)" +RUN echo "${TOOLBOX_VERSION}" > /app/TOOLBOX_VERSION # Set default command CMD ["/bin/zsh"] \ No newline at end of file From 85548b08476655fdcfd2d35b5f83296b58ce74c2 Mon Sep 17 00:00:00 2001 From: Garth Johnson Date: Fri, 29 Dec 2023 07:14:33 +0000 Subject: [PATCH 10/16] removed bad version test --- Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index e4e0d29..fd1e774 100644 --- a/Dockerfile +++ b/Dockerfile @@ -88,7 +88,5 @@ ADD --chown=1000:1000 src/.p10k.zsh /home/$USERNAME/.p10k.zsh ADD --chown=1000:1000 --chmod=+x src/tasks.py . ADD --chown=1000:1000 --chmod=+x https://private-sw-downloads.s3.amazonaws.com/archfx_broker/preflight/broker_preflight.sh . -ARG TOOLBOX_VERSION="$(git describe --tags `git rev-list --tags --max-count=1`)" -RUN echo "${TOOLBOX_VERSION}" > /app/TOOLBOX_VERSION # Set default command CMD ["/bin/zsh"] \ No newline at end of file From e18eeb383b84db3fb60bc2b67bb82a244c996a43 Mon Sep 17 00:00:00 2001 From: Garth Johnson Date: Sun, 31 Dec 2023 09:01:24 +0000 Subject: [PATCH 11/16] added Docker test tasks --- src/tasks.py | 124 ++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 88 insertions(+), 36 deletions(-) diff --git a/src/tasks.py b/src/tasks.py index a256cb9..b993590 100644 --- a/src/tasks.py +++ b/src/tasks.py @@ -1,4 +1,5 @@ from invoke import task +import invoke import logging import docker import pyfiglet @@ -26,7 +27,6 @@ def _set_log_level(verbose=0) -> None: # Actually set the logging level logging.basicConfig(level=log_levels[verbose]) - ########################################### # Tasks @@ -72,41 +72,6 @@ def hello(c, name="world", verbose=0): logger.debug("Said hello.") -@task(incrementable=['verbose']) -def dockerinfo(c, verbose=0): - """Get Docker installation information - """ - - _set_log_level(verbose) - - logger.debug("Looking for Docker installation...") - - ####TODO: add try/except - client = docker.DockerClient(base_url='unix://var/run/docker.sock') - - info = client.info() - client.close() - - print(f"{'Árchetecture':<20}: {info.get('Architecture')}") - print(f"{'Containers':<20}: {info.get('Containers')}") - print(f"{'Containers Running':<20}: {info.get('ContainersRunning')}") - print(f"{'DockerRootDir':<20}: {info.get('DockerRootDir')}") - print(f"{'HttpProxy':<20}: {info.get('HttpProxy')}") - print(f"{'HttpsProxy':<20}: {info.get('HttpsProxy')}") - print(f"{'Images':<20}: {info.get('Images')}") - print(f"{'KernelVersion':<20}: {info.get('KernelVersion')}") - print(f"{'LoggingDriver':<20}: {info.get('LoggingDriver')}") - print(f"{'Name':<20}: {info.get('Name')}") - print(f"{'NoProxy':<20}: {info.get('NoProxy')}") - print(f"{'OSType':<20}: {info.get('OSType')}") - print(f"{'OperatingSystem':<20}: {info.get('OperatingSystem')}") - print(f"{'ServerVersion':<20}: {info.get('ServerVersion')}") - print(f"{'SystemTime':<20}: {info.get('SystemTime')}") - - from pprint import pprint - #pprint(client.df()) - - @task(incrementable=['verbose']) def netspeed(c, verbose=0): """Run an internet speedtest @@ -137,3 +102,90 @@ def netspeed(c, verbose=0): print(f"{'PING':<20}: {int(s.results.ping)}ms") print(f"{'UPLOAD':<20}: {int(s.results.upload / 1024 / 1024)}Mbps") print(f"{'DOWNLOAD':<20}: {int(s.results.download / 1024 / 1024)}Mbps") + + +@task(incrementable=['verbose']) +def dockerinfo(c, verbose=0): + """Get Docker installation information + """ + + _set_log_level(verbose) + + logger.debug("Looking for Docker installation...") + + try: + client = docker.from_env() + except Exception as e: + raise invoke.Exit("ERROR: Docker connection failed.", e) + info = client.info() + plugins = client.plugins.list() + client.close() + + print('-'*40) + print(f"{'System Name':<20}: {info.get('Name')}") + print(f"{'Árchetecture':<20}: {info.get('Architecture')}") + print(f"{'OSType':<20}: {info.get('OSType')}") + print(f"{'Kernel Version':<20}: {info.get('KernelVersion')}") + print(f"{'Operating System':<20}: {info.get('OperatingSystem')}") + print(f"{'System Time':<20}: {info.get('SystemTime')}") + + print('-'*40) + print(f"{'Docker Version':<20}: {info.get('ServerVersion')}") + print(f"{'Docker Root':<20}: {info.get('DockerRootDir')}") + print(f"{'Logging Driver':<20}: {info.get('LoggingDriver')}") + print(f"{'Images':<20}: {info.get('Images')}") + print(f"{'Containers':<20}: {info.get('Containers')}") + print(f"{'Containers Running':<20}: {info.get('ContainersRunning')}") + loki = next((x for x in plugins if x.name == 'loki:latest'), None) + if loki: + print(f"{'Loki':<20}: {loki.name}") + print(f"{' ':<20}: {'enabled' if loki.enabled else 'disabled'}") + for setting in loki.settings: + print(f"{' ':<20}: {setting}:{loki.settings.get(setting)}") + else: + print(f"{'Loki':<20}: {'Loki not found'}") + + print('-'*40) + print(f"{'HttpProxy':<20}: {info.get('HttpProxy')}") + print(f"{'HttpsProxy':<20}: {info.get('HttpsProxy')}") + print(f"{'NoProxy':<20}: {info.get('NoProxy')}") + print('-'*40) + + #from pprint import pprint + #pprint(ddf['Volumes']) + +####TODO: check outbound connections + print(f"{'verify correct time':<20}: {'TBD'}") +####TODO: add task to check remaining disk size on host system + print(f"{'Drive space':<20}: {'TBD'}") +####TODO: check outbound connections + print(f"{'Firewall':<20}: {'TBD'}") + #declare -a urls=("https://www.google.com 200" + # "https://arch.archfx.io/api/v1/server/ 200" + # "https://portainer.overseer.archfx.io 200" + # "https://portaineredge.overseer.archfx.io 404" + # "https://ecr.archfx.io 401" +####TODO: get docker-compose version + +@task(incrementable=['verbose']) +def dockertest(c, verbose=0): + """Test Docker installation + """ + + _set_log_level(verbose) + + logger.debug("Testing Docker installation...") + + try: + client = docker.from_env() + except Exception as e: + raise invoke.Exit("ERROR: Docker connection failed.", e) + info = client.info() + plugins = client.plugins.list() + # print(client.containers.run('netyeti/toolbox:latest', 'echo hello world')) + client.images.pull("netyeti/toolbox:latest") + + from pprint import pprint + pprint(client.swarm.attrs) + + client.close() From a5a92d3d31cb6347a33f667d0e5a175477c0c770 Mon Sep 17 00:00:00 2001 From: Garth Johnson Date: Sun, 31 Dec 2023 09:06:18 +0000 Subject: [PATCH 12/16] added docker test tasks --- src/broker_preflight.sh | 239 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 239 insertions(+) create mode 100755 src/broker_preflight.sh diff --git a/src/broker_preflight.sh b/src/broker_preflight.sh new file mode 100755 index 0000000..dcc6d4c --- /dev/null +++ b/src/broker_preflight.sh @@ -0,0 +1,239 @@ +#!/usr/bin/env bash +#set -e + +DEBUG=${DEBUG:=false} +if $DEBUG; then + echo "Debug on, all commands will be displayed" + set -x +fi + +# Archfx Broker for linux installation script +# +# See ... for the installation steps +# +# This script is meant for quick and easy setup of your Broker environment via: +# $ curl -fsSL https://private-sw-downloads.s3.amazonaws.com/archfx_broker/preflight/broker_preflight.sh -o broker_preflight.sh && chmod +x broker_preflight.sh +# $ ./broker_preflight.sh check +# $ ./broker_preflight.sh report +# + +# Variables +readonly ME=$(basename "$0") + +readonly BASE_DIR=${BASE_DIR:-'/opt'} +readonly INST_DIR=${INST_DIR:-$BASE_DIR/archfx} +readonly DEPLOY_DIR=$INST_DIR/broker +readonly DOCKER_CFG_DIR=/etc/docker +OFFLINE=${OFFLINE:=false} + + +####################################### +# Output CMDs +####################################### +function _banner_msg () { + echo -e "\n$@" +} +function _success_msg () { + echo -e "$@" +} +function _failure_msg () { + echo -e "FAILURE: $@" + exit 1 +} +function _warning_msg () { + echo "WARNING: $@" +} + + +####################################### +# DOCKER COMMANDS +####################################### +function _where_is_docker() { + ### Get docker insallation location ### + echo $( which docker ) +} + + +function _docker_root_dir() { + ### Get docker root dir ### + root_dir=$(docker info | grep 'Docker Root Dir:' | cut -d " " -f5) + echo $root_dir +} + + +function _is_docker_running() { + echo $(docker --version) +} + + +function _is_loki_plugin_installed() { + echo $(docker plugin ls | grep loki) +} + + +####################################### +# Inspect OS +####################################### +function _get_distribution() { + ### Save distro to logfile ### + local lsb_dist="" + # Every system that we officially support has /etc/os-release + if [ -r /etc/os-release ]; then + lsb_dist="$(. /etc/os-release && echo "$ID")" + fi + echo "$lsb_dist" +} + + +function _get_distro_version() { + ### Save distro version ### + local lsb_dist_id="" + # Every system that we officially support has /etc/os-release + if [ -r /etc/os-release ]; then + lsb_dist_id="$(. /etc/os-release && echo "$VERSION_ID")" + fi + echo "$lsb_dist_id" +} + + +function _get_dir_size() { + ### Save distro to logfile ### + dir=$1 + local directory_size=$(df ${dir} | awk 'NR==2 {print $4}') + echo $directory_size +} + + +#################### +# Other +#################### +function _outbound_connections() { + ### Check if we can get info from the server ### + url=$1 + expected=$2 + if $OFFLINE;then + echo -e "no" + else + response=$(curl -L -s -o /dev/null -w "%{http_code}" $url) + if (( $response == $expected )); then + connect="yes" + else + connect="no (response code: $response)" + fi + fi + echo $connect +} + + +####################################### +# Verifiy basic requirements +####################################### +function preflight_checks() { + ### Checks to see everything is as we want + # Arguments: + # log_file = where to save the data + # + # Output: + # logs_${EPOCH}.txt = formatted output + ### + _banner_msg "Running pre-flight checks" + + local -ir minute=$(date -u +%s) + local log_file="$PWD/logs_$minute.txt" + _success_msg "\tGenerating log file: $log_file" + + echo -e "date:" | tee "$log_file" + echo -e "\tlocal: $(date)" | tee -a "$log_file" + echo -e "\tutc: $(date -u +%s)" | tee -a "$log_file" + + echo -e "vm:" | tee -a "$log_file" + echo -e "\thost: $(hostname)" | tee -a "$log_file" + lsb_dist=$(_get_distribution "$log_file") + echo -e "\tdistribution: $lsb_dist" | tee -a "$log_file" + echo -e "\tversion: $(_get_distro_version)" | tee -a "$log_file" + directory_size=$(_get_dir_size "/") + echo -e "\troot: /" | tee -a "$log_file" + echo -e "\t\tsize: $directory_size" | tee -a "$log_file" + + directory_size=$(_get_dir_size "$INST_DIR") + echo -e "\tarchfx_dir: $INST_DIR" | tee -a "$log_file" + echo -e "\t\tsize: $directory_size" | tee -a "$log_file" + + echo -e "docker:" | tee -a "$log_file" + echo -e "\tlocation: $(_where_is_docker)" | tee -a "$log_file" + echo -e "\trunning: $(_is_docker_running)" | tee -a "$log_file" + echo -e "\tdata_root: $(_docker_root_dir)" | tee -a "$log_file" + + + echo -e "\tloki: $(_is_loki_plugin_installed)" | tee -a "$log_file" + + echo -e "outbound_connections:" | tee -a "$log_file" + declare -a urls=("https://www.google.com 200" + "https://arch.archfx.io/api/v1/server/ 200" + "https://portainer.overseer.archfx.io 200" + "https://portaineredge.overseer.archfx.io 404" + "https://ecr.archfx.io 401" + ) + for url_response in "${urls[@]}"; do + read -ra url_response <<< "$url_response" # turn url and response into an array + echo -e "\turl: ${url_response[0]}" | tee -a "$log_file" + echo -e "\t\tconnected: $(_outbound_connections ${url_response[@]})" | tee -a "$log_file" + done +} + + +####################################### +# Display latest report +####################################### +function latest_report() { + ls -t logs_* >/dev/null + if [ $? -eq 0 ]; then + file=$(ls -t logs_* | head -1) + echo ${PWD}/$file + cat $file + else + _warning_msg "Log files not yet created. Run:" + _success_msg "\n./broker_preflight.sh check" + fi +} + + +####################################### +# Command Line Arguments +####################################### +function usage () { + echo "ArchFX Broker preflight checklist" + echo "" + echo "Usage: $ME [options]" + echo "Options:" + echo " $ME check : Runs checks and generates report" + echo " $ME report : Displays last report" + echo " $ME help : Prints this usage" + echo "" +} + + +function do_arguments() { + if (( $# < 1 )); then + usage + exit 0 + fi + + local args="$@" + + + if [[ ${args} == 'check' ]]; then + preflight_checks + elif [[ ${args} == 'report' ]]; then + latest_report + elif [[ ${args} == 'help' ]]; then + usage + else + usage + _failure_msg "Error: Unknown Command: ${args}" + fi + exit 0 +} +####################################### +# Having this as the last line guarantees that the entire file has been read +do_arguments $@ From e662fbb72bc454f196fa3bea72300a894c1b8d67 Mon Sep 17 00:00:00 2001 From: Garth Johnson Date: Fri, 9 Feb 2024 22:48:55 +0000 Subject: [PATCH 13/16] added example bash script to basic-test network --- src/nodes.list | 5 +++++ src/test_net.sh | 58 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 src/nodes.list create mode 100755 src/test_net.sh diff --git a/src/nodes.list b/src/nodes.list new file mode 100644 index 0000000..6de43cc --- /dev/null +++ b/src/nodes.list @@ -0,0 +1,5 @@ +127.0.0.1 +1.1.1.1 +8.8.8.8 +google.com +microsoft.com \ No newline at end of file diff --git a/src/test_net.sh b/src/test_net.sh new file mode 100755 index 0000000..4ffe9f3 --- /dev/null +++ b/src/test_net.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +# File with nodes to test, one address per line +NODES_FILE=./nodes.list + +# Test for color support +# check if stdout is a terminal... +if test -t 1; then + + # see if it supports colors... + ncolors=$(tput colors) + + if test -n "$ncolors" && test $ncolors -ge 8; then + bold="$(tput bold)" + underline="$(tput smul)" + standout="$(tput smso)" + normal="$(tput sgr0)" + black="$(tput setaf 0)" + red="$(tput setaf 1)" + green="$(tput setaf 2)" + yellow="$(tput setaf 3)" + blue="$(tput setaf 4)" + magenta="$(tput setaf 5)" + cyan="$(tput setaf 6)" + white="$(tput setaf 7)" + fi +fi + +# Show the date this script was run +date + +# Get the primary interface IP and device name +ip4=$(/sbin/ip route get 8.8.8.8 | awk '/src/ { print $7 }') +dev=$(/sbin/ip route get 8.8.8.8 | awk '/src/ { print $5 }') +echo "Host IP address on $dev: $ip4" + +# Get and test acces to the default gateway +default_gateway=$(/sbin/ip route | awk '/default/ { print $3 }') +ping -c 1 "$default_gateway" > /dev/null +if [ $? -eq 0 ]; then +echo "- node $default_gateway (default gateway) is ${green}accessible${normal}" +else +echo "ERROR: default gateway ($default_gateway) is ${red}${bold}unreachable${normal}" +exit 1 +fi + +# Loop over supplied node addresses list if it exists +if test -f ${NODES_FILE}; then +cat ${NODES_FILE} | while read output +do + ping -c 1 "$output" > /dev/null + if [ $? -eq 0 ]; then + echo "- node $output is ${green}accessible${normal}" + else + echo "- node $output is ${red}${bold}unreachable${normal}" + fi +done +fi From cba107e05fa39f68581ae65d5adeaea4140217d9 Mon Sep 17 00:00:00 2001 From: Garth Johnson Date: Fri, 9 Feb 2024 23:28:01 +0000 Subject: [PATCH 14/16] Added test_net and docs --- Dockerfile | 3 +++ README.md | 6 ++++++ src/nodes.list | 3 ++- src/test_net.sh | 4 ++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index fd1e774..509f1f2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -88,5 +88,8 @@ ADD --chown=1000:1000 src/.p10k.zsh /home/$USERNAME/.p10k.zsh ADD --chown=1000:1000 --chmod=+x src/tasks.py . ADD --chown=1000:1000 --chmod=+x https://private-sw-downloads.s3.amazonaws.com/archfx_broker/preflight/broker_preflight.sh . +ADD --chown=1000:1000 --chmod=+x src/test_net.sh . +ADD --chown=1000:1000 src/nodes.list . + # Set default command CMD ["/bin/zsh"] \ No newline at end of file diff --git a/README.md b/README.md index 7b79ef3..1dce433 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,12 @@ Using `tcpdump` can either be done from within a shell of the toolbox container, docker run --rm -it --net=host ghcr.io/growlf/toolbox sudo tcpdump +### Running scripts and commands + +You can also run arbitrary commands and scripts directly from the commandline like so: + + docker compose run --rm -it app1 ./test_net.sh + ## Invoke Some tasks to add to the default options: diff --git a/src/nodes.list b/src/nodes.list index 6de43cc..945a215 100644 --- a/src/nodes.list +++ b/src/nodes.list @@ -2,4 +2,5 @@ 1.1.1.1 8.8.8.8 google.com -microsoft.com \ No newline at end of file +microsoft.com +failed.ip.does.not.exist \ No newline at end of file diff --git a/src/test_net.sh b/src/test_net.sh index 4ffe9f3..13fab3b 100755 --- a/src/test_net.sh +++ b/src/test_net.sh @@ -34,6 +34,10 @@ ip4=$(/sbin/ip route get 8.8.8.8 | awk '/src/ { print $7 }') dev=$(/sbin/ip route get 8.8.8.8 | awk '/src/ { print $5 }') echo "Host IP address on $dev: $ip4" +# Get external IP address +external=$(dig @resolver4.opendns.com myip.opendns.com +short) +echo "Public IP address: $external" + # Get and test acces to the default gateway default_gateway=$(/sbin/ip route | awk '/default/ { print $3 }') ping -c 1 "$default_gateway" > /dev/null From fe42cb94391951735cadc62fbc52d1733a9543d0 Mon Sep 17 00:00:00 2001 From: Garth Johnson Date: Sun, 11 Feb 2024 15:01:01 -0800 Subject: [PATCH 15/16] added ansible tool --- ansible/inventory.yml | 10 ++++++++++ src/requirements.txt | 1 + 2 files changed, 11 insertions(+) create mode 100644 ansible/inventory.yml diff --git a/ansible/inventory.yml b/ansible/inventory.yml new file mode 100644 index 0000000..d0efe4b --- /dev/null +++ b/ansible/inventory.yml @@ -0,0 +1,10 @@ +myhosts: + hosts: + localhost: + ansible_host: localhost + server1: + ansible_host: server1 + server2: + ansible_host: server2 + server3: + ansible_host: nexus diff --git a/src/requirements.txt b/src/requirements.txt index 462dfd6..4f3b0df 100644 --- a/src/requirements.txt +++ b/src/requirements.txt @@ -6,3 +6,4 @@ portscan==1.1 pyfiglet==1.0.2 speedtest-cli==2.1.3 urllib3==2.1.0 +ansible==9.2.0 From b827914aa5c7253f7282c74ee5c62c9f4eb5bfac Mon Sep 17 00:00:00 2001 From: "C. Daniel Eguia" Date: Mon, 18 Nov 2024 10:01:04 -0800 Subject: [PATCH 16/16] adds pytest to the dev container, and updates the setting file to include the existing tests (#148) --- .devcontainer/devcontainer.json | 3 ++- .vscode/settings.json | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 8e1e2cd..66da964 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -34,7 +34,8 @@ "installTools": true, "version": "3.11" }, - "ghcr.io/warrenbuckley/codespace-features/sqlite:1": {} + "ghcr.io/warrenbuckley/codespace-features/sqlite:1": {}, + "ghcr.io/hspaans/devcontainer-features/pytest:1": {} }, // Use 'forwardPorts' to make a list of ports inside the container available locally. diff --git a/.vscode/settings.json b/.vscode/settings.json index 534d4ca..b3fa722 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,8 @@ { - "editor.fontFamily": "'MesloLGS NF', 'Droid Sans Mono', 'monospace', monospace" + "editor.fontFamily": "'MesloLGS NF', 'Droid Sans Mono', 'monospace', monospace", + "python.testing.pytestArgs": [ + "tests" + ], + "python.testing.unittestEnabled": false, + "python.testing.pytestEnabled": true } \ No newline at end of file