From c0105fbfe41971db0b4bdb19703df684c3966345 Mon Sep 17 00:00:00 2001 From: Florian Rey Date: Mon, 14 Oct 2024 09:29:42 +0200 Subject: [PATCH] [Lazy] Switch to zsh / oh-my-zsh --- lazy.ansible/.manala/Makefile.tmpl | 2 +- lazy.ansible/.manala/docker/Dockerfile.tmpl | 14 +- .../.manala/etc/profile.d/oh-my-bash.sh.tmpl | 148 ----------------- .../.manala/etc/profile.d/zz-direnv.sh.tmpl | 8 - .../message.sh.tmpl => zsh/.zlogin.tmpl} | 2 +- lazy.ansible/.manala/etc/zsh/.zshrc.tmpl | 109 ++++++++++++ lazy.ansible/test/goss.yaml | 2 +- lazy.kubernetes/.manala.yaml | 8 - lazy.kubernetes/.manala.yaml.tmpl | 9 - lazy.kubernetes/.manala/Makefile.tmpl | 2 +- .../.manala/docker/Dockerfile.tmpl | 138 ++++++++------- .../.manala/etc/profile.d/oh-my-bash.sh.tmpl | 146 ---------------- .../.manala/etc/profile.d/zz-direnv.sh.tmpl | 8 - .../message.sh.tmpl => zsh/.zlogin.tmpl} | 10 +- lazy.kubernetes/.manala/etc/zsh/.zshrc.tmpl | 134 +++++++++++++++ lazy.kubernetes/test/.manala.yaml | 4 - lazy.kubernetes/test/goss.yaml | 5 +- lazy.symfony/.manala/Makefile.tmpl | 2 +- lazy.symfony/.manala/docker/Dockerfile.tmpl | 14 +- .../.manala/etc/profile.d/oh-my-bash.sh.tmpl | 157 ------------------ .../.manala/etc/profile.d/zz-direnv.sh.tmpl | 8 - .../message.sh.tmpl => zsh/.zlogin.tmpl} | 3 +- lazy.symfony/.manala/etc/zsh/.zshrc.tmpl | 109 ++++++++++++ lazy.symfony/test/goss.yaml | 2 +- 24 files changed, 459 insertions(+), 585 deletions(-) delete mode 100644 lazy.ansible/.manala/etc/profile.d/oh-my-bash.sh.tmpl delete mode 100644 lazy.ansible/.manala/etc/profile.d/zz-direnv.sh.tmpl rename lazy.ansible/.manala/etc/{profile.d/message.sh.tmpl => zsh/.zlogin.tmpl} (100%) create mode 100644 lazy.ansible/.manala/etc/zsh/.zshrc.tmpl delete mode 100644 lazy.kubernetes/.manala/etc/profile.d/oh-my-bash.sh.tmpl delete mode 100644 lazy.kubernetes/.manala/etc/profile.d/zz-direnv.sh.tmpl rename lazy.kubernetes/.manala/etc/{profile.d/message.sh.tmpl => zsh/.zlogin.tmpl} (91%) create mode 100644 lazy.kubernetes/.manala/etc/zsh/.zshrc.tmpl delete mode 100644 lazy.symfony/.manala/etc/profile.d/oh-my-bash.sh.tmpl delete mode 100644 lazy.symfony/.manala/etc/profile.d/zz-direnv.sh.tmpl rename lazy.symfony/.manala/etc/{profile.d/message.sh.tmpl => zsh/.zlogin.tmpl} (99%) create mode 100644 lazy.symfony/.manala/etc/zsh/.zshrc.tmpl diff --git a/lazy.ansible/.manala/Makefile.tmpl b/lazy.ansible/.manala/Makefile.tmpl index c5b99c31..49f3cafb 100644 --- a/lazy.ansible/.manala/Makefile.tmpl +++ b/lazy.ansible/.manala/Makefile.tmpl @@ -54,7 +54,7 @@ sh: else \ $(call manala_docker_command, \ $(if $(PORT),--publish $(PORT)), \ - ) bash --login ; \ + ) zsh --login ; \ fi .PHONY: sh diff --git a/lazy.ansible/.manala/docker/Dockerfile.tmpl b/lazy.ansible/.manala/docker/Dockerfile.tmpl index 0cfd6a8e..146bd04f 100644 --- a/lazy.ansible/.manala/docker/Dockerfile.tmpl +++ b/lazy.ansible/.manala/docker/Dockerfile.tmpl @@ -29,7 +29,6 @@ RUN \ apt-get --quiet update \ && apt-get --quiet --yes --purge --autoremove upgrade \ && apt-get --quiet --yes --no-install-recommends --verbose-versions install \ - bash-completion \ bzip2 \ ca-certificates \ curl \ @@ -43,9 +42,10 @@ RUN \ socat \ sudo \ vim \ + zsh \ # User && addgroup --gid ${MANALA_GROUP_ID} lazy \ - && adduser --home /home/lazy --shell /bin/bash --uid ${MANALA_USER_ID} --gecos lazy --ingroup lazy --disabled-password lazy \ + && adduser --home /home/lazy --shell /bin/zsh --uid ${MANALA_USER_ID} --gecos lazy --ingroup lazy --disabled-password lazy \ && install --verbose --mode 0755 --group lazy --owner lazy --directory /run/user/${MANALA_USER_ID} \ && echo "lazy ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/lazy \ # Gosu @@ -70,8 +70,12 @@ RUN \ && chmod +x /usr/local/bin/yq \ # Bash completion && install --verbose --mode 0755 --directory /etc/bash_completion.d \ - # Oh My Bash - && git clone https://github.com/ohmybash/oh-my-bash.git /usr/local/share/oh-my-bash \ + # Oh My Zsh + && git clone https://github.com/ohmyzsh/ohmyzsh.git /usr/local/share/oh-my-zsh \ + # See: https://github.com/ohmyzsh/ohmyzsh/issues/11995 + && git clone https://github.com/zsh-users/zsh-autosuggestions /usr/local/share/oh-my-zsh/custom/plugins/zsh-autosuggestions \ + && git clone https://github.com/zsh-users/zsh-syntax-highlighting.git /usr/local/share/oh-my-zsh/custom/plugins/zsh-syntax-highlighting \ + && echo "ZDOTDIR=/etc/zsh" > /etc/zsh/zshenv \ # Clean && rm -rf /var/lib/apt/lists/* @@ -207,4 +211,4 @@ complete -C /usr/local/bin/terraform tf\n\ # Run COPY docker/entrypoint.sh / ENTRYPOINT ["/entrypoint.sh"] -CMD ["bash"] +CMD ["zsh"] diff --git a/lazy.ansible/.manala/etc/profile.d/oh-my-bash.sh.tmpl b/lazy.ansible/.manala/etc/profile.d/oh-my-bash.sh.tmpl deleted file mode 100644 index fe240f8f..00000000 --- a/lazy.ansible/.manala/etc/profile.d/oh-my-bash.sh.tmpl +++ /dev/null @@ -1,148 +0,0 @@ -# Enable the subsequent settings only in interactive sessions -case $- in - *i*) ;; - *) return;; -esac - -# Path to your oh-my-bash installation. -export OSH=/usr/local/share/oh-my-bash - -# Set name of the theme to load. Optionally, if you set this to "random" -# it'll load a random theme each time that oh-my-bash is loaded. -OSH_THEME="font" - -# If you set OSH_THEME to "random", you can ignore themes you don't like. -# OMB_THEME_RANDOM_IGNORED=("powerbash10k" "wanelo") - -# Uncomment the following line to use case-sensitive completion. -# OMB_CASE_SENSITIVE="true" - -# Uncomment the following line to use hyphen-insensitive completion. Case -# sensitive completion must be off. _ and - will be interchangeable. -# OMB_HYPHEN_SENSITIVE="false" - -# Uncomment the following line to disable bi-weekly auto-update checks. -DISABLE_AUTO_UPDATE="true" - -# Uncomment the following line to change how often to auto-update (in days). -# export UPDATE_OSH_DAYS=13 - -# 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. -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 don't want the repository to be considered dirty -# if there are untracked files. -# SCM_GIT_DISABLE_UNTRACKED_DIRTY="true" - -# Uncomment the following line if you want to completely ignore the presence -# of untracked files in the repository. -# SCM_GIT_IGNORE_UNTRACKED="true" - -# Uncomment the following line if you want to change the command execution time -# stamp shown in the history command output. One of the following values can -# be used to specify the timestamp format. -# * 'mm/dd/yyyy' # mm/dd/yyyy + time -# * 'dd.mm.yyyy' # dd.mm.yyyy + time -# * 'yyyy-mm-dd' # yyyy-mm-dd + time -# * '[mm/dd/yyyy]' # [mm/dd/yyyy] + [time] with colors -# * '[dd.mm.yyyy]' # [dd.mm.yyyy] + [time] with colors -# * '[yyyy-mm-dd]' # [yyyy-mm-dd] + [time] with colors -# If not set, the default value is 'yyyy-mm-dd'. -# HIST_STAMPS='yyyy-mm-dd' - -# Uncomment the following line if you do not want OMB to overwrite the existing -# aliases by the default OMB aliases defined in lib/*.sh -# OMB_DEFAULT_ALIASES="check" - -# Would you like to use another custom folder than $OSH/custom? -# OSH_CUSTOM=/path/to/new-custom-folder - -# To disable the uses of "sudo" by oh-my-bash, please set "false" to -# this variable. The default behavior for the empty value is "true". -OMB_USE_SUDO=true - -# To enable/disable display of Python virtualenv and condaenv -# OMB_PROMPT_SHOW_PYTHON_VENV=true # enable -# OMB_PROMPT_SHOW_PYTHON_VENV=false # disable - -# Which completions would you like to load? (completions can be found in ~/.oh-my-bash/completions/*) -# Custom completions may be added to ~/.oh-my-bash/custom/completions/ -# Example format: completions=(ssh git bundler gem pip pip3) -# Add wisely, as too many completions slow down shell startup. -completions=( - git - ssh -) - -# Which aliases would you like to load? (aliases can be found in ~/.oh-my-bash/aliases/*) -# Custom aliases may be added to ~/.oh-my-bash/custom/aliases/ -# Example format: aliases=(vagrant composer git-avh) -# Add wisely, as too many aliases slow down shell startup. -aliases=( - general - ls -) - -# Which plugins would you like to load? (plugins can be found in ~/.oh-my-bash/plugins/*) -# Custom plugins may be added to ~/.oh-my-bash/custom/plugins/ -# Example format: plugins=(rails git textmate ruby lighthouse) -# Add wisely, as too many plugins slow down shell startup. -plugins=( - git - ansible -) - -# Which plugins would you like to conditionally load? (plugins can be found in ~/.oh-my-bash/plugins/*) -# Custom plugins may be added to ~/.oh-my-bash/custom/plugins/ -# Example format: -# if [ "$DISPLAY" ] || [ "$SSH" ]; then -# plugins+=(tmux-autoattach) -# fi - -source "$OSH"/oh-my-bash.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" - -# ssh -# export SSH_KEY_PATH="~/.ssh/rsa_id" - -# Set personal aliases, overriding those provided by oh-my-bash libs, -# plugins, and themes. Aliases can be placed here, though oh-my-bash -# users are encouraged to define aliases within the OSH_CUSTOM folder. -# For a full list of active aliases, run `alias`. -# -# Example aliases -# alias bashconfig="mate ~/.bashrc" -# alias ohmybash="mate ~/.oh-my-bash" - -# Disable full path print after cd into a directory -# See: https://github.com/ohmybash/oh-my-bash/issues/201 -unset CDPATH diff --git a/lazy.ansible/.manala/etc/profile.d/zz-direnv.sh.tmpl b/lazy.ansible/.manala/etc/profile.d/zz-direnv.sh.tmpl deleted file mode 100644 index 24ea5737..00000000 --- a/lazy.ansible/.manala/etc/profile.d/zz-direnv.sh.tmpl +++ /dev/null @@ -1,8 +0,0 @@ -eval "$(direnv hook bash)" - -# Config directory -export DIRENV_CONFIG=/etc/direnv - -# Faint output -# See: https://github.com/direnv/direnv/wiki/Quiet-or-Silence-direnv -export DIRENV_LOG_FORMAT=$'\033[2mdirenv: %s\033[0m' diff --git a/lazy.ansible/.manala/etc/profile.d/message.sh.tmpl b/lazy.ansible/.manala/etc/zsh/.zlogin.tmpl similarity index 100% rename from lazy.ansible/.manala/etc/profile.d/message.sh.tmpl rename to lazy.ansible/.manala/etc/zsh/.zlogin.tmpl index 3c1fea7d..2e686c95 100644 --- a/lazy.ansible/.manala/etc/profile.d/message.sh.tmpl +++ b/lazy.ansible/.manala/etc/zsh/.zlogin.tmpl @@ -32,10 +32,10 @@ printf " \033[36m· {{ $dependency }}\033[0m\n" {{- if $terraform.version }} printf " \033[36m‣ terraform \033[35m{{ $terraform.version }}\033[0m\n" {{- end }} +printf "\n" {{- $help := .Vars.project.help }} {{- if $help }} -printf "\n" cat << EOF {{ $help }} EOF diff --git a/lazy.ansible/.manala/etc/zsh/.zshrc.tmpl b/lazy.ansible/.manala/etc/zsh/.zshrc.tmpl new file mode 100644 index 00000000..0b6d1cae --- /dev/null +++ b/lazy.ansible/.manala/etc/zsh/.zshrc.tmpl @@ -0,0 +1,109 @@ +# If you come from bash you might have to change your $PATH. +# export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH + +# Path to your Oh My Zsh installation. +export ZSH=/usr/local/share/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" + +# 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 + direnv + zsh-autosuggestions + zsh-syntax-highlighting +) + +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='nvim' +# fi + +# Compilation flags +# export ARCHFLAGS="-arch $(uname -m)" + +# 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 a top-level file in +# the $ZSH_CUSTOM folder, with .zsh extension. Examples: +# - $ZSH_CUSTOM/aliases.zsh +# - $ZSH_CUSTOM/macos.zsh +# For a full list of active aliases, run `alias`. +# +# Example aliases +# alias zshconfig="mate ~/.zshrc" +# alias ohmyzsh="mate ~/.oh-my-zsh" diff --git a/lazy.ansible/test/goss.yaml b/lazy.ansible/test/goss.yaml index b08ab95d..875c0dbe 100644 --- a/lazy.ansible/test/goss.yaml +++ b/lazy.ansible/test/goss.yaml @@ -26,7 +26,7 @@ user: exists: true groups: - lazy - shell: /bin/bash + shell: /bin/zsh file: # Base diff --git a/lazy.kubernetes/.manala.yaml b/lazy.kubernetes/.manala.yaml index 64ef01d3..98e7081c 100644 --- a/lazy.kubernetes/.manala.yaml +++ b/lazy.kubernetes/.manala.yaml @@ -98,18 +98,10 @@ system: # @schema {"enum": [null, "1.30.0"]} # @option {"label": "Stern version"} version: ~ - kube-prompt: - # @schema {"enum": [null, "1.0.11"]} - # @option {"label": "Kube-prompt version"} - version: ~ popeye: # @schema {"enum": [null, "0.21.5"]} # @option {"label": "Popeye version"} version: ~ - knsk: - # @schema {"enum": [null, "1.0"]} - # @option {"label": "Kubernetes namespace killer version"} - version: ~ vault: # @schema {"enum": [null, "1.17.5", "1.16.3", "1.15.6", "1.14.10"]} # @option {"label": "Vault version"} diff --git a/lazy.kubernetes/.manala.yaml.tmpl b/lazy.kubernetes/.manala.yaml.tmpl index 56bbd23a..9d6d396f 100644 --- a/lazy.kubernetes/.manala.yaml.tmpl +++ b/lazy.kubernetes/.manala.yaml.tmpl @@ -48,19 +48,10 @@ system: stern: version: {{ .Vars.system.stern.version | toYaml }} {{- end }} - {{- $kubePrompt := index .Vars.system "kube-prompt" -}} - {{- if $kubePrompt.version }} - kube-prompt: - version: {{ $kubePrompt.version | toYaml }} - {{- end }} {{- if .Vars.system.popeye.version }} popeye: version: {{ .Vars.system.popeye.version | toYaml }} {{- end }} - {{- if .Vars.system.knsk.version }} - knsk: - version: {{ .Vars.system.knsk.version | toYaml }} - {{- end }} {{- if .Vars.system.vault.version }} vault: version: {{ .Vars.system.vault.version | toYaml }} diff --git a/lazy.kubernetes/.manala/Makefile.tmpl b/lazy.kubernetes/.manala/Makefile.tmpl index c5b99c31..49f3cafb 100644 --- a/lazy.kubernetes/.manala/Makefile.tmpl +++ b/lazy.kubernetes/.manala/Makefile.tmpl @@ -54,7 +54,7 @@ sh: else \ $(call manala_docker_command, \ $(if $(PORT),--publish $(PORT)), \ - ) bash --login ; \ + ) zsh --login ; \ fi .PHONY: sh diff --git a/lazy.kubernetes/.manala/docker/Dockerfile.tmpl b/lazy.kubernetes/.manala/docker/Dockerfile.tmpl index ddedb4ba..67231565 100644 --- a/lazy.kubernetes/.manala/docker/Dockerfile.tmpl +++ b/lazy.kubernetes/.manala/docker/Dockerfile.tmpl @@ -29,7 +29,6 @@ RUN \ apt-get --quiet update \ && apt-get --quiet --yes --purge --autoremove upgrade \ && apt-get --quiet --yes --no-install-recommends --verbose-versions install \ - bash-completion \ bzip2 \ ca-certificates \ curl \ @@ -43,9 +42,10 @@ RUN \ socat \ sudo \ vim \ + zsh \ # User && addgroup --gid ${MANALA_GROUP_ID} lazy \ - && adduser --home /home/lazy --shell /bin/bash --uid ${MANALA_USER_ID} --gecos lazy --ingroup lazy --disabled-password lazy \ + && adduser --home /home/lazy --shell /bin/zsh --uid ${MANALA_USER_ID} --gecos lazy --ingroup lazy --disabled-password lazy \ && install --verbose --mode 0755 --group lazy --owner lazy --directory /run/user/${MANALA_USER_ID} \ && echo "lazy ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/lazy \ # Gosu @@ -68,10 +68,12 @@ RUN \ && curl -sSLf "https://github.com/mikefarah/yq/releases/download/v${YQ_VERSION}/yq_linux_{{ include "arch_map" (dict "amd64" "amd64" "arm64" "arm64") }}" \ --output /usr/local/bin/yq \ && chmod +x /usr/local/bin/yq \ - # Bash completion - && install --verbose --mode 0755 --directory /etc/bash_completion.d \ - # Oh My Bash - && git clone https://github.com/ohmybash/oh-my-bash.git /usr/local/share/oh-my-bash \ + # Oh My Zsh + && git clone https://github.com/ohmyzsh/ohmyzsh.git /usr/local/share/oh-my-zsh \ + # See: https://github.com/ohmyzsh/ohmyzsh/issues/11995 + && git clone https://github.com/zsh-users/zsh-autosuggestions /usr/local/share/oh-my-zsh/custom/plugins/zsh-autosuggestions \ + && git clone https://github.com/zsh-users/zsh-syntax-highlighting.git /usr/local/share/oh-my-zsh/custom/plugins/zsh-syntax-highlighting \ + && echo "ZDOTDIR=/etc/zsh" > /etc/zsh/zshenv \ # Clean && rm -rf /var/lib/apt/lists/* @@ -136,14 +138,7 @@ RUN \ {{ $kubectl := .Vars.system.kubectl -}} RUN \ curl -sSLf "https://dl.k8s.io/v{{ $kubectl.version }}/kubernetes-client-linux-{{ include "arch_map" (dict "amd64" "amd64" "arm64" "arm64") }}.tar.gz" \ - | bsdtar -xvf - -C /usr/local/bin --strip-components=3 kubernetes/client/bin/kubectl \ - # Bash completion - && kubectl completion bash > /etc/bash_completion.d/kubectl \ - # Bash aliases - && printf "\ -alias k='kubectl'\n\ -complete -F __start_kubectl k\n\ -" > /etc/profile.d/kubectl.sh + | bsdtar -xvf - -C /usr/local/bin --strip-components=3 kubernetes/client/bin/kubectl {{ $helm := .Vars.system.helm -}} {{ if $helm.version -}} @@ -151,14 +146,7 @@ complete -F __start_kubectl k\n\ ENV HELM_PLUGINS="/usr/local/share/helm/plugins" RUN \ curl -sSLf "https://get.helm.sh/helm-v{{ $helm.version }}-linux-{{ include "arch_map" (dict "amd64" "amd64" "arm64" "arm64") }}.tar.gz" \ - | bsdtar -xvf - -C /usr/local/bin --strip-components=1 "linux-{{ include "arch_map" (dict "amd64" "amd64" "arm64" "arm64") }}/helm" \ - # Bash completion - && helm completion bash > /etc/bash_completion.d/helm \ - # Bash aliases - && printf "\ -alias h='helm'\n\ -complete -F __start_helm h\n\ -" > /etc/profile.d/helm.sh + | bsdtar -xvf - -C /usr/local/bin --strip-components=1 "linux-{{ include "arch_map" (dict "amd64" "amd64" "arm64" "arm64") }}/helm" {{- if $helm.plugins }} \ # Plugins {{- range $i, $plugin := $helm.plugins }} @@ -179,15 +167,23 @@ ENV HELMFILE_UPGRADE_NOTICE_DISABLED="1" RUN \ curl -sSLf "https://github.com/helmfile/helmfile/releases/download/v{{ $helmfile.version }}/helmfile_{{ $helmfile.version }}_linux_{{ include "arch_map" (dict "amd64" "amd64" "arm64" "arm64") }}.tar.gz" \ | bsdtar -xvf - -C /usr/local/bin helmfile \ - # Bash completion - && helmfile completion bash > /etc/bash_completion.d/helmfile \ - # Bash aliases + # Oh My Zsh plugin + # See: https://github.com/ohmyzsh/ohmyzsh/pull/12750 + && mkdir /usr/local/share/oh-my-zsh/custom/plugins/helmfile \ && printf "\ +if (( ! $+commands[helmfile] )); then\n\ + return\n\ +fi\n\ +if [[ ! -f \"\$ZSH_CACHE_DIR/completions/_helmfile\" ]]; then\n\ + helmfile completion zsh | tee \"\$ZSH_CACHE_DIR/completions/_helmfile\" >/dev/null\n\ + source \"\$ZSH_CACHE_DIR/completions/_helmfile\"\n\ +else\n\ + source \"\$ZSH_CACHE_DIR/completions/_helmfile\"\n\ + helmfile completion zsh | tee \"\$ZSH_CACHE_DIR/completions/_helmfile\" >/dev/null &|\n\ +fi\n\ alias hf='helmfile'\n\ -complete -F __start_helmfile hf\n\ alias hfi='helmfile --interactive'\n\ -complete -F __start_helmfile hfi\n\ -" > /etc/profile.d/helmfile.sh +" > /usr/local/share/oh-my-zsh/custom/plugins/helmfile/helmfile.plugin.zsh {{ end -}} @@ -206,19 +202,21 @@ RUN \ RUN \ curl -sSLf "https://github.com/stern/stern/releases/download/v{{ $stern.version }}/stern_{{ $stern.version }}_linux_{{ include "arch_map" (dict "amd64" "amd64" "arm64" "arm64") }}.tar.gz" \ | bsdtar -xvf - -C /usr/local/bin stern \ - # Bash completion - && stern --completion=bash > /etc/bash_completion.d/stern - -{{ end -}} - -{{ $kubePrompt := index .Vars.system "kube-prompt" -}} -{{ if $kubePrompt.version -}} -# Kube Prompt -RUN \ - curl -sSLf "https://github.com/c-bata/kube-prompt/releases/download/v{{ $kubePrompt.version }}/kube-prompt_v{{ $kubePrompt.version }}_linux_{{ include "arch_map" (dict "amd64" "amd64" "arm64" "arm64") }}.zip" \ - | bsdtar -xvf - -C /usr/local/bin \ - && chmod +x /usr/local/bin/kube-prompt - + # Oh My Zsh plugin + # See: https://github.com/ohmyzsh/ohmyzsh/pull/12751 + && mkdir /usr/local/share/oh-my-zsh/custom/plugins/stern \ + && printf "\ +if (( ! $+commands[stern] )); then\n\ + return\n\ +fi\n\ +if [[ ! -f \"\$ZSH_CACHE_DIR/completions/_stern\" ]]; then\n\ + stern --completion zsh | tee \"\$ZSH_CACHE_DIR/completions/_stern\" >/dev/null\n\ + source \"\$ZSH_CACHE_DIR/completions/_stern\"\n\ +else\n\ + source \"\$ZSH_CACHE_DIR/completions/_stern\"\n\ + stern --completion zsh | tee \"\$ZSH_CACHE_DIR/completions/_stern\" >/dev/null &|\n\ +fi\n\ +" > /usr/local/share/oh-my-zsh/custom/plugins/stern/stern.plugin.zsh {{ end -}} {{ $popeye := .Vars.system.popeye -}} @@ -230,15 +228,6 @@ RUN \ {{ end -}} -{{ $knsk := .Vars.system.knsk -}} -{{ if $knsk.version -}} -# Knsk -RUN \ - curl -sSLf https://github.com/thyarles/knsk/archive/refs/tags/v{{ $knsk.version }}.tar.gz \ - | bsdtar -xvf - -C /usr/local/bin --strip-components=1 knsk-{{ $knsk.version }}/knsk.sh - -{{ end -}} - {{ $vault := .Vars.system.vault -}} {{ if $vault.version -}} # Vault @@ -246,8 +235,15 @@ RUN \ curl -sSLf "https://releases.hashicorp.com/vault/{{ $vault.version }}/vault_{{ $vault.version }}_linux_{{ include "arch_map" (dict "amd64" "amd64" "arm64" "arm64") }}.zip" \ | bsdtar -xvf - -C /usr/local/bin \ && chmod +x /usr/local/bin/vault \ - # Bash completion - && echo "complete -C /usr/local/bin/vault vault" > /etc/bash_completion.d/vault + # Oh My Zsh plugin + # See: https://github.com/ohmyzsh/ohmyzsh/pull/12753 + && mkdir /usr/local/share/oh-my-zsh/custom/plugins/vault \ + && printf "\ +if (( ! $+commands[helmfile] )); then\n\ + return\n\ +fi\n\ +complete -o nospace -C vault vault\n\ +" > /usr/local/share/oh-my-zsh/custom/plugins/vault/vault.plugin.zsh {{ end -}} @@ -258,8 +254,21 @@ RUN \ curl -sSLf "https://downloads.rclone.org/v{{ $rclone.version }}/rclone-v{{ $rclone.version }}-linux-{{ include "arch_map" (dict "amd64" "amd64" "arm64" "arm64") }}.zip" \ | bsdtar -xvf - -C /usr/local/bin --strip-components=1 "rclone-v{{ $rclone.version }}-linux-{{ include "arch_map" (dict "amd64" "amd64" "arm64" "arm64") }}/rclone" \ && chmod +x /usr/local/bin/rclone \ - # Bash completion - && rclone genautocomplete bash /etc/bash_completion.d/rclone + # Oh My Zsh plugin + # See: https://github.com/ohmyzsh/ohmyzsh/pull/12754 + && mkdir /usr/local/share/oh-my-zsh/custom/plugins/rclone \ + && printf "\ +if (( ! $+commands[rclone] )); then\n\ + return\n\ +fi\n\ +if [[ ! -f \"\$ZSH_CACHE_DIR/completions/_rclone\" ]]; then\n\ + rclone completion zsh - | tee \"\$ZSH_CACHE_DIR/completions/_rclone\" >/dev/null\n\ + source \"\$ZSH_CACHE_DIR/completions/_rclone\"\n\ +else\n\ + source \"\$ZSH_CACHE_DIR/completions/_rclone\"\n\ + rclone completion zsh - | tee \"\$ZSH_CACHE_DIR/completions/_rclone\" >/dev/null &|\n\ +fi\n\ +" > /usr/local/share/oh-my-zsh/custom/plugins/rclone/rclone.plugin.zsh {{ end -}} @@ -320,8 +329,23 @@ RUN \ curl -sSLf "https://github.com/scaleway/scaleway-cli/releases/download/v{{ $scw.version }}/scaleway-cli_{{ $scw.version }}_linux_{{ include "arch_map" (dict "amd64" "amd64" "arm64" "arm64") }}" \ --output /usr/local/bin/scw \ && chmod +x /usr/local/bin/scw \ - # Bash completion - && scw autocomplete script shell=/bin/bash > /etc/bash_completion.d/scw + # Oh My Zsh plugin + # See: https://github.com/ohmyzsh/ohmyzsh/pull/12755 + && mkdir /usr/local/share/oh-my-zsh/custom/plugins/scw \ + && printf "\ +if (( ! $+commands[scw] )); then\n\ + return\n\ +fi\n\ +_scw () {\n\ + output=(\$(scw autocomplete complete zsh -- \${CURRENT} \${words}))\n\ + opts=('-S' ' ')\n\ + if [[ \$output == *= ]]; then\n\ + opts=('-S' '')\n\ + fi\n\ + compadd \"\${opts[@]}\" -- \"\${output[@]}\"\n\ +}\n\ +compdef _scw scw\n\ +" > /usr/local/share/oh-my-zsh/custom/plugins/scw/scw.plugin.zsh {{ end -}} @@ -406,4 +430,4 @@ RUN \ # Run COPY docker/entrypoint.sh / ENTRYPOINT ["/entrypoint.sh"] -CMD ["bash"] +CMD ["zsh"] diff --git a/lazy.kubernetes/.manala/etc/profile.d/oh-my-bash.sh.tmpl b/lazy.kubernetes/.manala/etc/profile.d/oh-my-bash.sh.tmpl deleted file mode 100644 index 43cfcc57..00000000 --- a/lazy.kubernetes/.manala/etc/profile.d/oh-my-bash.sh.tmpl +++ /dev/null @@ -1,146 +0,0 @@ -# Enable the subsequent settings only in interactive sessions -case $- in - *i*) ;; - *) return;; -esac - -# Path to your oh-my-bash installation. -export OSH=/usr/local/share/oh-my-bash - -# Set name of the theme to load. Optionally, if you set this to "random" -# it'll load a random theme each time that oh-my-bash is loaded. -OSH_THEME="font" - -# If you set OSH_THEME to "random", you can ignore themes you don't like. -# OMB_THEME_RANDOM_IGNORED=("powerbash10k" "wanelo") - -# Uncomment the following line to use case-sensitive completion. -# OMB_CASE_SENSITIVE="true" - -# Uncomment the following line to use hyphen-insensitive completion. Case -# sensitive completion must be off. _ and - will be interchangeable. -# OMB_HYPHEN_SENSITIVE="false" - -# Uncomment the following line to disable bi-weekly auto-update checks. -DISABLE_AUTO_UPDATE="true" - -# Uncomment the following line to change how often to auto-update (in days). -# export UPDATE_OSH_DAYS=13 - -# 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. -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 don't want the repository to be considered dirty -# if there are untracked files. -# SCM_GIT_DISABLE_UNTRACKED_DIRTY="true" - -# Uncomment the following line if you want to completely ignore the presence -# of untracked files in the repository. -# SCM_GIT_IGNORE_UNTRACKED="true" - -# Uncomment the following line if you want to change the command execution time -# stamp shown in the history command output. One of the following values can -# be used to specify the timestamp format. -# * 'mm/dd/yyyy' # mm/dd/yyyy + time -# * 'dd.mm.yyyy' # dd.mm.yyyy + time -# * 'yyyy-mm-dd' # yyyy-mm-dd + time -# * '[mm/dd/yyyy]' # [mm/dd/yyyy] + [time] with colors -# * '[dd.mm.yyyy]' # [dd.mm.yyyy] + [time] with colors -# * '[yyyy-mm-dd]' # [yyyy-mm-dd] + [time] with colors -# If not set, the default value is 'yyyy-mm-dd'. -# HIST_STAMPS='yyyy-mm-dd' - -# Uncomment the following line if you do not want OMB to overwrite the existing -# aliases by the default OMB aliases defined in lib/*.sh -# OMB_DEFAULT_ALIASES="check" - -# Would you like to use another custom folder than $OSH/custom? -# OSH_CUSTOM=/path/to/new-custom-folder - -# To disable the uses of "sudo" by oh-my-bash, please set "false" to -# this variable. The default behavior for the empty value is "true". -OMB_USE_SUDO=true - -# To enable/disable display of Python virtualenv and condaenv -# OMB_PROMPT_SHOW_PYTHON_VENV=true # enable -# OMB_PROMPT_SHOW_PYTHON_VENV=false # disable - -# Which completions would you like to load? (completions can be found in ~/.oh-my-bash/completions/*) -# Custom completions may be added to ~/.oh-my-bash/custom/completions/ -# Example format: completions=(ssh git bundler gem pip pip3) -# Add wisely, as too many completions slow down shell startup. -completions=( - git -) - -# Which aliases would you like to load? (aliases can be found in ~/.oh-my-bash/aliases/*) -# Custom aliases may be added to ~/.oh-my-bash/custom/aliases/ -# Example format: aliases=(vagrant composer git-avh) -# Add wisely, as too many aliases slow down shell startup. -aliases=( - general - ls -) - -# Which plugins would you like to load? (plugins can be found in ~/.oh-my-bash/plugins/*) -# Custom plugins may be added to ~/.oh-my-bash/custom/plugins/ -# Example format: plugins=(rails git textmate ruby lighthouse) -# Add wisely, as too many plugins slow down shell startup. -plugins=( - git -) - -# Which plugins would you like to conditionally load? (plugins can be found in ~/.oh-my-bash/plugins/*) -# Custom plugins may be added to ~/.oh-my-bash/custom/plugins/ -# Example format: -# if [ "$DISPLAY" ] || [ "$SSH" ]; then -# plugins+=(tmux-autoattach) -# fi - -source "$OSH"/oh-my-bash.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" - -# ssh -# export SSH_KEY_PATH="~/.ssh/rsa_id" - -# Set personal aliases, overriding those provided by oh-my-bash libs, -# plugins, and themes. Aliases can be placed here, though oh-my-bash -# users are encouraged to define aliases within the OSH_CUSTOM folder. -# For a full list of active aliases, run `alias`. -# -# Example aliases -# alias bashconfig="mate ~/.bashrc" -# alias ohmybash="mate ~/.oh-my-bash" - -# Disable full path print after cd into a directory -# See: https://github.com/ohmybash/oh-my-bash/issues/201 -unset CDPATH diff --git a/lazy.kubernetes/.manala/etc/profile.d/zz-direnv.sh.tmpl b/lazy.kubernetes/.manala/etc/profile.d/zz-direnv.sh.tmpl deleted file mode 100644 index 24ea5737..00000000 --- a/lazy.kubernetes/.manala/etc/profile.d/zz-direnv.sh.tmpl +++ /dev/null @@ -1,8 +0,0 @@ -eval "$(direnv hook bash)" - -# Config directory -export DIRENV_CONFIG=/etc/direnv - -# Faint output -# See: https://github.com/direnv/direnv/wiki/Quiet-or-Silence-direnv -export DIRENV_LOG_FORMAT=$'\033[2mdirenv: %s\033[0m' diff --git a/lazy.kubernetes/.manala/etc/profile.d/message.sh.tmpl b/lazy.kubernetes/.manala/etc/zsh/.zlogin.tmpl similarity index 91% rename from lazy.kubernetes/.manala/etc/profile.d/message.sh.tmpl rename to lazy.kubernetes/.manala/etc/zsh/.zlogin.tmpl index e81c2bd0..21f32125 100644 --- a/lazy.kubernetes/.manala/etc/profile.d/message.sh.tmpl +++ b/lazy.kubernetes/.manala/etc/zsh/.zlogin.tmpl @@ -34,18 +34,10 @@ printf " \033[36m‣ k9s \033[35m{{ $k9s.version }}\033[0m\n" {{- if $stern.version }} printf " \033[36m‣ stern \033[35m{{ $stern.version }}\033[0m\n" {{- end }} -{{- $kubePrompt := index .Vars.system "kube-prompt" }} -{{- if $kubePrompt.version }} -printf " \033[36m‣ kube-prompt \033[35m{{ $kubePrompt.version }}\033[0m\n" -{{- end }} {{- $popeye := .Vars.system.popeye }} {{- if $popeye.version }} printf " \033[36m‣ popeye \033[35m{{ $popeye.version }}\033[0m\n" {{- end }} -{{- $knsk := .Vars.system.knsk }} -{{- if $knsk.version }} -printf " \033[36m‣ knsk \033[35m{{ $knsk.version }}\033[0m\n" -{{- end }} {{- $vault := .Vars.system.vault }} {{- if $vault.version }} printf " \033[36m‣ vault \033[35m{{ $vault.version }}\033[0m\n" @@ -88,10 +80,10 @@ printf " \033[36m‣ age \033[35m{{ $age.version }}\033[0m\n" {{- if $argocd.version }} printf " \033[36m‣ argocd \033[35m{{ $argocd.version }}\033[0m\n" {{- end }} +printf "\n" {{- $help := .Vars.project.help }} {{- if $help }} -printf "\n" cat << EOF {{ $help }} EOF diff --git a/lazy.kubernetes/.manala/etc/zsh/.zshrc.tmpl b/lazy.kubernetes/.manala/etc/zsh/.zshrc.tmpl new file mode 100644 index 00000000..ac5fcba5 --- /dev/null +++ b/lazy.kubernetes/.manala/etc/zsh/.zshrc.tmpl @@ -0,0 +1,134 @@ +# If you come from bash you might have to change your $PATH. +# export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH + +# Path to your Oh My Zsh installation. +export ZSH=/usr/local/share/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" + +# 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 + direnv + zsh-autosuggestions + zsh-syntax-highlighting + kubectl +{{- if .Vars.system.docker }} + docker +{{- end }} +{{- if .Vars.system.helm.version }} + helm +{{- end }} +{{- if .Vars.system.helmfile.version }} + helmfile +{{- end }} +{{- if .Vars.system.k9s.version }} + k9s +{{- end }} +{{- if .Vars.system.stern.version }} + stern +{{- end }} +{{- if .Vars.system.vault.version }} + vault +{{- end }} +{{- if .Vars.system.rclone.version }} + rclone +{{- end }} +{{- if .Vars.system.scw.version }} + scw +{{- end }} +) + +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='nvim' +# fi + +# Compilation flags +# export ARCHFLAGS="-arch $(uname -m)" + +# 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 a top-level file in +# the $ZSH_CUSTOM folder, with .zsh extension. Examples: +# - $ZSH_CUSTOM/aliases.zsh +# - $ZSH_CUSTOM/macos.zsh +# For a full list of active aliases, run `alias`. +# +# Example aliases +# alias zshconfig="mate ~/.zshrc" +# alias ohmyzsh="mate ~/.oh-my-zsh" diff --git a/lazy.kubernetes/test/.manala.yaml b/lazy.kubernetes/test/.manala.yaml index ecb5b089..4ac3e1cd 100644 --- a/lazy.kubernetes/test/.manala.yaml +++ b/lazy.kubernetes/test/.manala.yaml @@ -36,12 +36,8 @@ system: version: 0.32.5 stern: version: 1.30.0 - kube-prompt: - version: 1.0.11 popeye: version: 0.21.5 - knsk: - version: "1.0" vault: version: 1.17.5 rclone: diff --git a/lazy.kubernetes/test/goss.yaml b/lazy.kubernetes/test/goss.yaml index af48d885..a07932b0 100644 --- a/lazy.kubernetes/test/goss.yaml +++ b/lazy.kubernetes/test/goss.yaml @@ -17,7 +17,7 @@ user: exists: true groups: - lazy - shell: /bin/bash + shell: /bin/zsh file: # Base @@ -109,9 +109,6 @@ command: exit-status: 0 stdout: - {{ .Vars.system.popeye.version }} - # Knsk - knsk.sh --help: - exit-status: 0 # Vault vault version: exit-status: 0 diff --git a/lazy.symfony/.manala/Makefile.tmpl b/lazy.symfony/.manala/Makefile.tmpl index b447fd8a..3aa29ac9 100644 --- a/lazy.symfony/.manala/Makefile.tmpl +++ b/lazy.symfony/.manala/Makefile.tmpl @@ -74,7 +74,7 @@ sh: if [ ! -t 0 ] ; then \ $(call manala_docker_command, --no-TTY) sh -s ; \ else \ - $(manala_docker_command) bash --login ; \ + $(manala_docker_command) zsh --login ; \ fi .PHONY: sh diff --git a/lazy.symfony/.manala/docker/Dockerfile.tmpl b/lazy.symfony/.manala/docker/Dockerfile.tmpl index 1f0b9a15..e564b1e3 100644 --- a/lazy.symfony/.manala/docker/Dockerfile.tmpl +++ b/lazy.symfony/.manala/docker/Dockerfile.tmpl @@ -29,7 +29,6 @@ RUN \ apt-get --quiet update \ && apt-get --quiet --yes --purge --autoremove upgrade \ && apt-get --quiet --yes --no-install-recommends --verbose-versions install \ - bash-completion \ bzip2 \ ca-certificates \ curl \ @@ -43,9 +42,10 @@ RUN \ socat \ sudo \ vim \ + zsh \ # User && addgroup --gid ${MANALA_GROUP_ID} lazy \ - && adduser --home /home/lazy --shell /bin/bash --uid ${MANALA_USER_ID} --gecos lazy --ingroup lazy --disabled-password lazy \ + && adduser --home /home/lazy --shell /bin/zsh --uid ${MANALA_USER_ID} --gecos lazy --ingroup lazy --disabled-password lazy \ && install --verbose --mode 0755 --group lazy --owner lazy --directory /run/user/${MANALA_USER_ID} \ && echo "lazy ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/lazy \ # Gosu @@ -68,10 +68,12 @@ RUN \ && curl -sSLf "https://github.com/mikefarah/yq/releases/download/v${YQ_VERSION}/yq_linux_{{ include "arch_map" (dict "amd64" "amd64" "arm64" "arm64") }}" \ --output /usr/local/bin/yq \ && chmod +x /usr/local/bin/yq \ - # Bash completion - && install --verbose --mode 0755 --directory /etc/bash_completion.d \ - # Oh My Bash - && git clone https://github.com/ohmybash/oh-my-bash.git /usr/local/share/oh-my-bash \ + # Oh My Zsh + && git clone https://github.com/ohmyzsh/ohmyzsh.git /usr/local/share/oh-my-zsh \ + # See: https://github.com/ohmyzsh/ohmyzsh/issues/11995 + && git clone https://github.com/zsh-users/zsh-autosuggestions /usr/local/share/oh-my-zsh/custom/plugins/zsh-autosuggestions \ + && git clone https://github.com/zsh-users/zsh-syntax-highlighting.git /usr/local/share/oh-my-zsh/custom/plugins/zsh-syntax-highlighting \ + && echo "ZDOTDIR=/etc/zsh" > /etc/zsh/zshenv \ # Clean && rm -rf /var/lib/apt/lists/* diff --git a/lazy.symfony/.manala/etc/profile.d/oh-my-bash.sh.tmpl b/lazy.symfony/.manala/etc/profile.d/oh-my-bash.sh.tmpl deleted file mode 100644 index 847ed7c5..00000000 --- a/lazy.symfony/.manala/etc/profile.d/oh-my-bash.sh.tmpl +++ /dev/null @@ -1,157 +0,0 @@ -# Enable the subsequent settings only in interactive sessions -case $- in - *i*) ;; - *) return;; -esac - -# Path to your oh-my-bash installation. -export OSH=/usr/local/share/oh-my-bash - -# Set name of the theme to load. Optionally, if you set this to "random" -# it'll load a random theme each time that oh-my-bash is loaded. -OSH_THEME="font" - -# If you set OSH_THEME to "random", you can ignore themes you don't like. -# OMB_THEME_RANDOM_IGNORED=("powerbash10k" "wanelo") - -# Uncomment the following line to use case-sensitive completion. -# OMB_CASE_SENSITIVE="true" - -# Uncomment the following line to use hyphen-insensitive completion. Case -# sensitive completion must be off. _ and - will be interchangeable. -# OMB_HYPHEN_SENSITIVE="false" - -# Uncomment the following line to disable bi-weekly auto-update checks. -DISABLE_AUTO_UPDATE="true" - -# Uncomment the following line to change how often to auto-update (in days). -# export UPDATE_OSH_DAYS=13 - -# 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. -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 don't want the repository to be considered dirty -# if there are untracked files. -# SCM_GIT_DISABLE_UNTRACKED_DIRTY="true" - -# Uncomment the following line if you want to completely ignore the presence -# of untracked files in the repository. -# SCM_GIT_IGNORE_UNTRACKED="true" - -# Uncomment the following line if you want to change the command execution time -# stamp shown in the history command output. One of the following values can -# be used to specify the timestamp format. -# * 'mm/dd/yyyy' # mm/dd/yyyy + time -# * 'dd.mm.yyyy' # dd.mm.yyyy + time -# * 'yyyy-mm-dd' # yyyy-mm-dd + time -# * '[mm/dd/yyyy]' # [mm/dd/yyyy] + [time] with colors -# * '[dd.mm.yyyy]' # [dd.mm.yyyy] + [time] with colors -# * '[yyyy-mm-dd]' # [yyyy-mm-dd] + [time] with colors -# If not set, the default value is 'yyyy-mm-dd'. -# HIST_STAMPS='yyyy-mm-dd' - -# Uncomment the following line if you do not want OMB to overwrite the existing -# aliases by the default OMB aliases defined in lib/*.sh -# OMB_DEFAULT_ALIASES="check" - -# Would you like to use another custom folder than $OSH/custom? -# OSH_CUSTOM=/path/to/new-custom-folder - -# To disable the uses of "sudo" by oh-my-bash, please set "false" to -# this variable. The default behavior for the empty value is "true". -OMB_USE_SUDO=true - -# To enable/disable display of Python virtualenv and condaenv -# OMB_PROMPT_SHOW_PYTHON_VENV=true # enable -# OMB_PROMPT_SHOW_PYTHON_VENV=false # disable - -# Which completions would you like to load? (completions can be found in ~/.oh-my-bash/completions/*) -# Custom completions may be added to ~/.oh-my-bash/custom/completions/ -# Example format: completions=(ssh git bundler gem pip pip3) -# Add wisely, as too many completions slow down shell startup. -completions=( - git - composer - {{- if .Vars.system.nodejs.version }} - npm - {{- end }} - -) - -# Which aliases would you like to load? (aliases can be found in ~/.oh-my-bash/aliases/*) -# Custom aliases may be added to ~/.oh-my-bash/custom/aliases/ -# Example format: aliases=(vagrant composer git-avh) -# Add wisely, as too many aliases slow down shell startup. -aliases=( - general - ls -) - -# Which plugins would you like to load? (plugins can be found in ~/.oh-my-bash/plugins/*) -# Custom plugins may be added to ~/.oh-my-bash/custom/plugins/ -# Example format: plugins=(rails git textmate ruby lighthouse) -# Add wisely, as too many plugins slow down shell startup. -plugins=( - git - {{- if .Vars.system.nodejs.version }} - npm - {{- end }} - {{- if .Vars.deploy.inventory }} - ansible - {{- end }} -) - -# Which plugins would you like to conditionally load? (plugins can be found in ~/.oh-my-bash/plugins/*) -# Custom plugins may be added to ~/.oh-my-bash/custom/plugins/ -# Example format: -# if [ "$DISPLAY" ] || [ "$SSH" ]; then -# plugins+=(tmux-autoattach) -# fi - -source "$OSH"/oh-my-bash.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" - -# ssh -# export SSH_KEY_PATH="~/.ssh/rsa_id" - -# Set personal aliases, overriding those provided by oh-my-bash libs, -# plugins, and themes. Aliases can be placed here, though oh-my-bash -# users are encouraged to define aliases within the OSH_CUSTOM folder. -# For a full list of active aliases, run `alias`. -# -# Example aliases -# alias bashconfig="mate ~/.bashrc" -# alias ohmybash="mate ~/.oh-my-bash" - -# Disable full path print after cd into a directory -# See: https://github.com/ohmybash/oh-my-bash/issues/201 -unset CDPATH diff --git a/lazy.symfony/.manala/etc/profile.d/zz-direnv.sh.tmpl b/lazy.symfony/.manala/etc/profile.d/zz-direnv.sh.tmpl deleted file mode 100644 index 24ea5737..00000000 --- a/lazy.symfony/.manala/etc/profile.d/zz-direnv.sh.tmpl +++ /dev/null @@ -1,8 +0,0 @@ -eval "$(direnv hook bash)" - -# Config directory -export DIRENV_CONFIG=/etc/direnv - -# Faint output -# See: https://github.com/direnv/direnv/wiki/Quiet-or-Silence-direnv -export DIRENV_LOG_FORMAT=$'\033[2mdirenv: %s\033[0m' diff --git a/lazy.symfony/.manala/etc/profile.d/message.sh.tmpl b/lazy.symfony/.manala/etc/zsh/.zlogin.tmpl similarity index 99% rename from lazy.symfony/.manala/etc/profile.d/message.sh.tmpl rename to lazy.symfony/.manala/etc/zsh/.zlogin.tmpl index 0b383c4f..295383c0 100644 --- a/lazy.symfony/.manala/etc/profile.d/message.sh.tmpl +++ b/lazy.symfony/.manala/etc/zsh/.zlogin.tmpl @@ -19,10 +19,10 @@ printf " \033[36m‣ php \033[35m{{ $php.version }}\033[0m\n" {{- if $nodejs.version }} printf " \033[36m‣ nodejs \033[35m{{ $nodejs.version }}\033[0m\n" {{- end }} - printf "\n" printf " \033[36m• php-xdebug \033[35m[on|off] \033[37m- enable/disable php xdebug\033[0m\n" +printf "\n" php-xdebug () { if [ "$1" = on ]; then sudo phpenmod xdebug @@ -41,7 +41,6 @@ php-xdebug () { {{- $help := .Vars.project.help }} {{- if $help }} -printf "\n" cat << EOF {{ $help }} EOF diff --git a/lazy.symfony/.manala/etc/zsh/.zshrc.tmpl b/lazy.symfony/.manala/etc/zsh/.zshrc.tmpl new file mode 100644 index 00000000..0b6d1cae --- /dev/null +++ b/lazy.symfony/.manala/etc/zsh/.zshrc.tmpl @@ -0,0 +1,109 @@ +# If you come from bash you might have to change your $PATH. +# export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH + +# Path to your Oh My Zsh installation. +export ZSH=/usr/local/share/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" + +# 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 + direnv + zsh-autosuggestions + zsh-syntax-highlighting +) + +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='nvim' +# fi + +# Compilation flags +# export ARCHFLAGS="-arch $(uname -m)" + +# 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 a top-level file in +# the $ZSH_CUSTOM folder, with .zsh extension. Examples: +# - $ZSH_CUSTOM/aliases.zsh +# - $ZSH_CUSTOM/macos.zsh +# For a full list of active aliases, run `alias`. +# +# Example aliases +# alias zshconfig="mate ~/.zshrc" +# alias ohmyzsh="mate ~/.oh-my-zsh" diff --git a/lazy.symfony/test/goss.yaml b/lazy.symfony/test/goss.yaml index a8423c44..529567b6 100644 --- a/lazy.symfony/test/goss.yaml +++ b/lazy.symfony/test/goss.yaml @@ -25,7 +25,7 @@ user: exists: true groups: - lazy - shell: /bin/bash + shell: /bin/zsh file: # Base