X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=bin%2Faxzshctl;h=efc8a982f3d939f00ef8c13dc632c9067728046a;hb=HEAD;hp=0c996e5832cf3016ecd426f6fcea87e85fd05d5b;hpb=e931552a64b695219a9d3703997793cad7376847;p=ax-zsh.git diff --git a/bin/axzshctl b/bin/axzshctl index 0c996e5..943e464 100755 --- a/bin/axzshctl +++ b/bin/axzshctl @@ -1,7 +1,7 @@ #!/usr/bin/env zsh # # AX-ZSH: Alex' Modular ZSH Configuration -# Copyright (c) 2015-2022 Alexander Barton +# Copyright (c) 2015-2023 Alexander Barton # # Embedded ax-common compatibility functions ... @@ -22,12 +22,23 @@ function ax_error { function Version { echo "ax-zsh -- Modular configuration system for the Z shell (ZSH)" - echo "Copyright (c) 2015-2019 Alexander Barton ." + echo "Copyright (c) 2015-2023 Alexander Barton ." echo "Licensed under the terms of the MIT license, see LICENSE.md for details." echo "Homepage: " + echo + echo "Installation prefix: $AXZSH" + echo -n "Version: " if [[ -d "$AXZSH/.git" && -n "$commands[git]" ]]; then - echo -n "Version: Git ID " + echo -n "Git Commit-ID " ( cd "$AXZSH" && git describe --always ) + else + echo "unknown" + fi + echo -n "Active theme: " + if [[ -n "$AXZSH_THEME" ]]; then + echo "${AXZSH_THEME:A:t:r}" + else + echo "unknown" fi echo exit 0 @@ -47,6 +58,8 @@ function Usage { echo " Disable plugin(s)." echo " list-enabled" echo " List enabled plugins." + echo " plugin-help" + echo " Show help text for a plugin (when provided by the plugin)." echo echo " reset-plugins" echo " Reset active plugins to the default set." @@ -63,6 +76,11 @@ function Usage { echo " update-caches" echo " Force rebuild of all cache files." echo + echo " help" + echo " Show this help text." + echo " version" + echo " Show version and setup information." + echo exit 0 } @@ -234,6 +252,35 @@ function ListEnabledPlugins { return 0 } +function PluginHelp { + local plugin=$(NormalizedPluginName "$1") + local repo_plugin=$(echo "$plugin" | sed -e 's|#|/plugins/|') + local plugin_found= + + for plugin_d ( + "$plugin:A" + "$AXZSH/active_plugins/$plugin" + "$AXZSH/active_plugins/$repo_plugin" + "$AXZSH_PLUGIN_D/$plugin" + "$ZSH_CUSTOM/$plugin" + "$AXZSH/custom_plugins/$plugin" + "$AXZSH/repos/$plugin" + "$AXZSH/repos/$repo_plugin" + "$AXZSH/plugins/$plugin" + "$AXZSH/default_plugins/$plugin" + "$AXZSH/core/$plugin" + ); do + [[ -e "$plugin_d" ]] && plugin_found=1 + [[ -r "$plugin_d/README.md" ]] || continue + less "$plugin_d/README.md" + return 0 + done + [[ -n "$plugin_found" ]] \ + && echo "Plugin \"$1\" found, but no help available!" >&2 \ + || echo "Plugin \"$1\" not found!" >&2 + return 1 +} + function ResetPlugins { local dir="$AXZSH/active_plugins" local r1=0, r2=0 @@ -479,6 +526,10 @@ case "$cmd" in [[ $# -eq 0 ]] || Usage ListEnabledPlugins ;; + "plugin-help") + [[ $# -eq 1 ]] || Usage + PluginHelp "$1" + ;; "reset-plugins") [[ $# -eq 0 ]] || Usage ResetPlugins