From 3c2e311872f54b6639122a085a969a41fb52e919 Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Wed, 26 Oct 2016 10:38:18 +0200 Subject: [PATCH] Add axzshctl subcommand "list-enabled" --- bin/axzshctl | 17 +++++++++++++---- core/50_axzsh/functions/_axzsh | 1 + 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/bin/axzshctl b/bin/axzshctl index b5dfb72..8298743 100755 --- a/bin/axzshctl +++ b/bin/axzshctl @@ -23,22 +23,20 @@ function Usage { echo echo " enable" echo " Enable AX-ZSH altogether." - echo echo " disable" echo " Disable AX-ZSH altogether." echo echo " enable-plugin [ [...]]" echo " Enable plugin(s)." - echo echo " disable-plugin [ [...]]" echo " Disable plugin(s)." + echo " list-enabled" + echo " List enabled plugins." echo echo " reset-plugins" echo " Reset active plugins to the default set." - echo echo " enable-default-plugins" echo " Enable all default plugins." - echo echo " check-plugins" echo " Detect plugins which are \"useful\" on this system." echo @@ -136,6 +134,13 @@ function DisablePlugin { return $r } +function ListEnabledPlugins { + for plugin ($AXZSH/active_plugins/*(N)); do + print ${plugin:t:s/#/\//} + done + return 0 +} + function ResetPlugins { local dir="$AXZSH/active_plugins" local r1=0, r2=0 @@ -323,6 +328,10 @@ case "$cmd" in DisablePlugin "$plugin" done ;; + "list-enabled") + [[ $# -eq 0 ]] || Usage + ListEnabledPlugins + ;; "reset-plugins") [[ $# -eq 0 ]] || Usage ResetPlugins diff --git a/core/50_axzsh/functions/_axzsh b/core/50_axzsh/functions/_axzsh index 0142214..2a62f29 100644 --- a/core/50_axzsh/functions/_axzsh +++ b/core/50_axzsh/functions/_axzsh @@ -7,6 +7,7 @@ _axzshctl() { disable\:"Disable AX-ZSH." enable-plugin\:"Enable plugin(s)." disable-plugin\:"Disable plugin(s)." + list-enabled\:"List enabled plugin(s)." reset-plugins\:"Reset active plugins to the default set." enable-default-plugins\:"Enable all default plugins." check-plugins\:"Check \"useful\" plugins." -- 2.39.2