From dd7d75f898d43d36e3c34ff0a100520596295417 Mon Sep 17 00:00:00 2001 From: Marcus Whybrow Date: Thu, 31 May 2012 09:01:25 +0100 Subject: [PATCH] Added bash completion for the server "whitelist" commands. --- bash_completion/msm | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/bash_completion/msm b/bash_completion/msm index 1919ded..a318093 100644 --- a/bash_completion/msm +++ b/bash_completion/msm @@ -90,6 +90,26 @@ _msm() { options="$(find "$JAR_STORAGE_PATH/${COMP_WORDS[3]}" -type f -name "*.jar" -exec basename {} \;)" fi ;; + whitelist|wl) + if [[ $COMP_CWORD == 3 ]]; then + options="on off add remove list" + else + case "${COMP_WORDS[3]}" in + remove) + whitelist_path="${server_path}/$DEFAULT_WHITELIST" + + # Override with server specific value if present + server_conf="${server_path}/$DEFAULT_SERVER_CONF" + if [ -e "$server_conf" ]; then + whitelist_path=$(grep "^WHITELIST=\".*\"" $server_conf | awk -F '"' '{print $2}') + fi + + if [ -f "$whitelist_path" ]; then + options=$(cat "$whitelist_path") + fi + ;; + esac + fi esac fi