]> arthur.barton.de Git - ax-zsh.git/commitdiff
Refactoring: Use "axzsh_" prefix (instead of "ax_") for all functions & variables
authorAlexander Barton <alex@barton.de>
Sat, 4 Dec 2021 12:37:17 +0000 (13:37 +0100)
committerAlexander Barton <alex@barton.de>
Sat, 4 Dec 2021 12:56:40 +0000 (13:56 +0100)
New function names:
- axzsh_hostname_prompt_root()
- axzsh_hostname_prompt_yn()
- axzsh_logname_prompt_root()
- axzsh_logname_prompt_yn()
- axzsh_plugin_fnc()
- axzsh_plugin_init()
- axzsh_prompt()
- axzsh_vcs_prompt()
- _axzsh_ssh_prompt()

New array names:
- axzsh_hostname_prompt_functions
- axzsh_logname_prompt_functions
- axzsh_vcs_prompt_functions

ax.zsh
bin/axzshctl
core/50_prompt/50_prompt.zshrc
core/99_cleanup/99_cleanup.zlogin
default_plugins/ssh/ssh.zshrc
plugins/git/git.zshrc
themes/ax.axzshtheme
themes/axemoji.axzshtheme
themes/debian.axzshtheme
themes/ohmyzsh.axzshtheme

diff --git a/ax.zsh b/ax.zsh
index c88c1920fd507fca123c0b51c1c8df54961be039..00c242ee55decc317b031aae6cababa0f3655d2f 100644 (file)
--- a/ax.zsh
+++ b/ax.zsh
@@ -46,7 +46,7 @@ function axzsh_handle_stage {
                [[ -n "$AXZSH_DEBUG" ]] \
                        && echo "   - Reading cache file \"$cache_file\" ..."
                source "$cache_file"
-               unfunction ax_plugin_init
+               unfunction axzsh_plugin_init
        else
                # No cache file available.
                local new_cache_file="$cache_file.NEW"
@@ -189,7 +189,7 @@ function axzsh_load_plugin {
 
                if [[ -n "$cache_file" ]]; then
                        # Add plugin data to cache
-                       printf "# BEGIN: %s\nax_plugin_init()\n{\n" "$fname" >>"$cache_file"
+                       printf "# BEGIN: %s\naxzsh_plugin_init()\n{\n" "$fname" >>"$cache_file"
                        case "$fname" in
                                *"/repos/"*)
                                        echo "[[ -n \"\$AXZSH_DEBUG\" ]] && echo '     - $plugin ($type): \"$fname\" ...'" >>$cache_file
@@ -199,7 +199,7 @@ function axzsh_load_plugin {
                                        echo "[[ -n \"\$AXZSH_DEBUG\" ]] && echo '     - $plugin ($type, cached) ...'" >>$cache_file
                                        "$cat_cmd" "$fname" >>"$cache_file"
                        esac
-                       printf "}\nax_plugin_init\n# END: %s\n\n" "$fname" >>"$cache_file"
+                       printf "}\naxzsh_plugin_init\n# END: %s\n\n" "$fname" >>"$cache_file"
                fi
        fi
 
index 8e1306ca91555e7edafb9d44e0f5ac7776d7f95c..34e22d2d02f8e039d703816110b806f4c342b253 100755 (executable)
@@ -362,9 +362,9 @@ function CheckPlugins {
        fi
        for p in $AXZSH/core/*/*.zshrc; do
                [[ "$(basename "$p")" == "01_zprofile.zshrc" ]] && continue
-               printf "# BEGIN: %s\nax_plugin_init()\n{\n" "$p" >>"$T"
+               printf "# BEGIN: %s\naxzsh_plugin_init()\n{\n" "$p" >>"$T"
                cat "$p" >>"$T"
-               printf "}\nax_plugin_init\n# END: %s\n\n" "$p" >>"$T"
+               printf "}\naxzsh_plugin_init\n# END: %s\n\n" "$p" >>"$T"
        done
 
        ax_msg - "Checking plugins ..."
@@ -387,8 +387,8 @@ function CheckPlugins {
                        (
                                AXZSH_PLUGIN_CHECK=1
                                source "$T"
-                               ax_plugin_fnc() { source "$script" }
-                               ax_plugin_fnc
+                               axzsh_plugin_fnc() { source "$script" }
+                               axzsh_plugin_fnc
                        ); r=$?
                        [[ $r -eq 0 ]] && new_plugin=$plugin
                        break
index 7aaf05307cccb1a905b319f1aa079b6368baff00..aea921d1cb270a9c58867727e70328bdc9c34529 100644 (file)
@@ -18,21 +18,21 @@ else
 fi
 ZSH_THEME_LOGNAME_PROMPT_SUFFIX_SPACING="@"
 
-function ax_logname_prompt_root() {
+function axzsh_logname_prompt_root() {
        (( $UID == 0 )) || return 1
        return 0
 }
 
-function ax_logname_prompt_yn() {
+function axzsh_logname_prompt_yn() {
        local func
-       for func ($ax_logname_prompt_functions); do
+       for func ($axzsh_logname_prompt_functions); do
                $func || continue
                echo "${ZSH_THEME_LOGNAME_PROMPT_PREFIX_SPACING}${ZSH_THEME_LOGNAME_PROMPT_PREFIX}${1:-$LOGNAME}${ZSH_THEME_LOGNAME_PROMPT_SUFFIX}${ZSH_THEME_LOGNAME_PROMPT_SUFFIX_SPACING}"
                return
        done
 }
 
-ax_logname_prompt_functions=(ax_logname_prompt_root)
+axzsh_logname_prompt_functions=(axzsh_logname_prompt_root)
 
 # Hostname
 
@@ -41,21 +41,21 @@ ZSH_THEME_HOSTNAME_PROMPT_PREFIX=""
 ZSH_THEME_HOSTNAME_PROMPT_SUFFIX=""
 ZSH_THEME_HOSTNAME_PROMPT_SUFFIX_SPACING=":"
 
-function ax_hostname_prompt_root() {
+function axzsh_hostname_prompt_root() {
        (( $UID == 0 )) || return 1
        return 0
 }
 
-function ax_hostname_prompt_yn() {
+function axzsh_hostname_prompt_yn() {
        local func
-       for func ($ax_hostname_prompt_functions); do
+       for func ($axzsh_hostname_prompt_functions); do
                $func || continue
                echo "${ZSH_THEME_HOSTNAME_PROMPT_PREFIX_SPACING}${ZSH_THEME_HOSTNAME_PROMPT_PREFIX}${1:-$SHORT_HOST}${ZSH_THEME_HOSTNAME_PROMPT_SUFFIX}${ZSH_THEME_HOSTNAME_PROMPT_SUFFIX_SPACING}"
                return
        done
 }
 
-ax_hostname_prompt_functions=()
+axzsh_hostname_prompt_functions=()
 
 # VCS
 
@@ -77,17 +77,17 @@ ZSH_THEME_VCS_PROMPT_BEHIND="%{$fg_no_bold[blue]%}$behind%{$fg[default]%}"
 
 unset clean dirty ahead behind
 
-function ax_vcs_prompt() {
+function axzsh_vcs_prompt() {
        local func
        local p
-       for func ($ax_vcs_prompt_functions); do
+       for func ($axzsh_vcs_prompt_functions); do
                p=$( $func ) || continue
                echo "${ZSH_THEME_VCS_PROMPT_PREFIX_SPACING}${p}${ZSH_THEME_VCS_PROMPT_SUFFIX_SPACING}"
                return
        done
 }
 
-ax_vcs_prompt_functions=()
+axzsh_vcs_prompt_functions=()
 
 # Prompt
 
@@ -100,7 +100,7 @@ ZSH_THEME_PROMPT_ROOT_PREFIX=""
 ZSH_THEME_PROMPT_SUFFIX=""
 ZSH_THEME_PROMPT_SUFFIX_SPACING=""
 
-function ax_prompt() {
+function axzsh_prompt() {
        local p
        (( $UID == 0 )) \
                && p="${ZSH_THEME_PROMPT_ROOT_PREFIX}${ZSH_THEME_PROMPT_ROOT}" \
index 764466b36220bb0eabf98ba96556027528fee984..1971cd07084c77694cd41abf4f324a471d4e2cf0 100644 (file)
@@ -2,24 +2,24 @@
 # 99_cleanup.zlogin: Don't pollute the namespace, remove variables/functions/...
 
 for func (
-       ax_hostname_prompt_root
-       ax_hostname_prompt_yn
-       ax_logname_prompt_root
-       ax_logname_prompt_yn
-       ax_prompt
+       axzsh_hostname_prompt_root
+       axzsh_hostname_prompt_yn
+       axzsh_logname_prompt_root
+       axzsh_logname_prompt_yn
+       axzsh_prompt
 ); do
        unfunction $func 2>/dev/null
 done
 
-for func ($ax_logname_prompt_functions); do
+for func ($axzsh_logname_prompt_functions); do
        unfunction $func 2>/dev/null
 done
-unset ax_logname_prompt_functions
+unset axzsh_logname_prompt_functions
 
-for func ($ax_hostname_prompt_functions); do
+for func ($axzsh_hostname_prompt_functions); do
        unfunction $func 2>/dev/null
 done
-unset ax_hostname_prompt_functions
+unset axzsh_hostname_prompt_functions
 
 # Try to map OhMyZsh theme Environment ...
 [[ -n "$ZSH_THEME_GIT_PROMPT_AHEAD" ]] \
index 0faab3c95fdd3b7c826121a4439896431faa629c..d275b06a3f00424e1016f407caf38066c0d851ab 100644 (file)
@@ -15,13 +15,13 @@ ssh-autoadd() {
        ssh-add
 }
 
-_ax_ssh_prompt() {
+_axzsh_ssh_prompt() {
        [[ -n "$SSH_CLIENT" ]] || return 1
        return 0
 }
 
-ax_logname_prompt_functions=($ax_logname_prompt_functions _ax_ssh_prompt)
-ax_hostname_prompt_functions=($ax_hostname_prompt_functions _ax_ssh_prompt)
+axzsh_logname_prompt_functions=($axzsh_logname_prompt_functions _axzsh_ssh_prompt)
+axzsh_hostname_prompt_functions=($axzsh_hostname_prompt_functions _axzsh_ssh_prompt)
 
 # Validate SSH_AUTH_SOCK: Inside of screen(1) sessions for example, the socket
 # file becomes invalid when the session has been disconnected.
index 4a4e430a083f8a5db05a77aaa059747bde091388..ba71aa486165af05d615c2514a691f7c7b887d85 100644 (file)
@@ -57,7 +57,7 @@ git_prompt() {
 # OhMyZsh compatibility functions
 alias parse_git_dirty=git_parse_dirty
 
-ax_vcs_prompt_functions=($ax_vcs_prompt_functions git_prompt)
+axzsh_vcs_prompt_functions=($axzsh_vcs_prompt_functions git_prompt)
 
 alias fix="gd --name-only | uniq | xargs $EDITOR"
 alias g="git"
index 0a4eda4a6c285c8143f3ef2bd7fa9e0ddb91cb20..ddb67f0711ba1d17e336f4419c6a65d97fc85f08 100644 (file)
@@ -9,11 +9,11 @@ ZSH_THEME_PROMPT_ROOT_PREFIX="%{$fg_bold[red]%}"
 ZSH_THEME_PROMPT_SUFFIX="%b%{$reset_color%}"
 ZSH_THEME_PROMPT_SUFFIX_SPACING=" "
 
-ax_logname_prompt_functions=($ax_logname_prompt_functions ax_logname_prompt_root)
-ax_hostname_prompt_functions=($ax_hostname_prompt_functions ax_hostname_prompt_root)
+axzsh_logname_prompt_functions=($axzsh_logname_prompt_functions axzsh_logname_prompt_root)
+axzsh_hostname_prompt_functions=($axzsh_hostname_prompt_functions axzsh_hostname_prompt_root)
 
 # The primary prompt string, printed before a command is read.
-PS1="$(ax_logname_prompt_yn)$(ax_hostname_prompt_yn)%B%2~%b"'$(ax_vcs_prompt)'"$(ax_prompt)"
+PS1="$(axzsh_logname_prompt_yn)$(axzsh_hostname_prompt_yn)%B%2~%b"'$(axzsh_vcs_prompt)'"$(axzsh_prompt)"
 
 # Primary prompt on the right-hand side.
 axzsh_is_utf_terminal \
index 331a3221fd1aa953701a7bda2faf079e315382af..ec1237677109de3a8819fe5ac8131e972eef808c 100644 (file)
@@ -32,7 +32,7 @@ else
 fi
 
 # The primary prompt string, printed before a command is read.
-PS1="${system_emoji}${emoji_spacing} $(ax_logname_prompt_yn)$(ax_hostname_prompt_yn)%B%2~%b"'$(ax_vcs_prompt)'"$(ax_prompt)"
+PS1="${system_emoji}${emoji_spacing} $(axzsh_logname_prompt_yn)$(axzsh_hostname_prompt_yn)%B%2~%b"'$(axzsh_vcs_prompt)'"$(axzsh_prompt)"
 
 # Default execution trace prompt.
 PS4="$fg_no_bold[yellow]->$reset_color "
index b16c4975910ec0fc882af5de071f7ca28352c680..5f004fbbd04e5acdcdbf91422710bd0925a9de97 100644 (file)
@@ -3,4 +3,4 @@
 
 ZSH_THEME_PROMPT_SUFFIX_SPACING=" "
 
-PS1="%{$fg_bold[green]%}%n@%m%{$reset_color%}:%{$fg_bold[blue]%}%~%{$reset_color%}"'$(ax_vcs_prompt)'"$(ax_prompt)"
+PS1="%{$fg_bold[green]%}%n@%m%{$reset_color%}:%{$fg_bold[blue]%}%~%{$reset_color%}"'$(axzsh_vcs_prompt)'"$(axzsh_prompt)"
index c3612c35e8cd584e5a832a7a69aa29ed06184b34..f3beed4383089f9d8c232fb1ca5532f5517911ab 100644 (file)
@@ -2,7 +2,7 @@
 # ohmyzsh.axzshtheme: OhMyZSH "robbyrussell" theme
 
 ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)"
-PS1='${ret_status} %{$fg[cyan]%}%c%b $(ax_vcs_prompt)%b '
+PS1='${ret_status} %{$fg[cyan]%}%c%b $(axzsh_vcs_prompt)%b '
 
 ZSH_THEME_VCS_PROMPT_PREFIX_SPACING="%{$fg_bold[blue]%}vcs:("
 ZSH_THEME_VCS_PROMPT_PREFIX="%{$fg[red]%}"