mirror of
https://github.com/msmhq/msm.git
synced 2024-08-30 18:12:35 +00:00
Fix #64, prevent tab completion crash when server name all
is used
This commit is contained in:
parent
dd30caaa1d
commit
92c9395423
@ -122,13 +122,16 @@ _msm() {
|
|||||||
*)
|
*)
|
||||||
# Server options
|
# Server options
|
||||||
|
|
||||||
local server_path="$SETTINGS_SERVER_STORAGE_PATH/${COMP_WORDS[1]}"
|
if [[ "${COMP_WORDS[1]}" == "all" ]]; then
|
||||||
if [[ "${COMP_WORDS[1]}" == "all" ]] || [ -e "$server_path" ]; then
|
local sid="-1"
|
||||||
# If the server exists
|
else
|
||||||
|
|
||||||
server_get_id "${COMP_WORDS[1]}"
|
server_get_id "${COMP_WORDS[1]}"
|
||||||
local sid="$RETURN"
|
local sid="$RETURN"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
local server_path="$SETTINGS_SERVER_STORAGE_PATH/${COMP_WORDS[1]}"
|
||||||
|
if [[ "${COMP_WORDS[1]}" == "all" ]] || [ -e "$server_path" ]; then
|
||||||
if [[ $COMP_CWORD == 2 ]]; then
|
if [[ $COMP_CWORD == 2 ]]; then
|
||||||
options="start stop restart status connected worlds logroll backup jar whitelist blacklist operator gamemode kick say time toggledownfall give xp save cmd cmdlog console config"
|
options="start stop restart status connected worlds logroll backup jar whitelist blacklist operator gamemode kick say time toggledownfall give xp save cmd cmdlog console config"
|
||||||
else
|
else
|
||||||
@ -142,7 +145,7 @@ _msm() {
|
|||||||
if [[ $COMP_CWORD == 3 ]]; then
|
if [[ $COMP_CWORD == 3 ]]; then
|
||||||
options="list load ram todisk backup on off"
|
options="list load ram todisk backup on off"
|
||||||
else
|
else
|
||||||
|
if [[ "${COMP_WORDS[1]}" != "all" ]]; then
|
||||||
case "${COMP_WORDS[3]}" in
|
case "${COMP_WORDS[3]}" in
|
||||||
ram)
|
ram)
|
||||||
if [[ $COMP_CWORD == 4 ]]; then
|
if [[ $COMP_CWORD == 4 ]]; then
|
||||||
@ -170,6 +173,7 @@ _msm() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
jar)
|
jar)
|
||||||
manager_property JAR_STORAGE_PATH
|
manager_property JAR_STORAGE_PATH
|
||||||
@ -185,6 +189,7 @@ _msm() {
|
|||||||
if [[ $COMP_CWORD == 3 ]]; then
|
if [[ $COMP_CWORD == 3 ]]; then
|
||||||
options="on off add remove list"
|
options="on off add remove list"
|
||||||
else
|
else
|
||||||
|
if [[ "${COMP_WORDS[1]}" != "all" ]]; then
|
||||||
case "${COMP_WORDS[3]}" in
|
case "${COMP_WORDS[3]}" in
|
||||||
remove)
|
remove)
|
||||||
if [[ $COMP_CWORD -ge 4 ]]; then
|
if [[ $COMP_CWORD -ge 4 ]]; then
|
||||||
@ -196,6 +201,7 @@ _msm() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
blacklist|bl)
|
blacklist|bl)
|
||||||
if [[ $COMP_CWORD == 3 ]]; then
|
if [[ $COMP_CWORD == 3 ]]; then
|
||||||
@ -206,6 +212,7 @@ _msm() {
|
|||||||
if [[ $COMP_CWORD == 4 ]]; then
|
if [[ $COMP_CWORD == 4 ]]; then
|
||||||
options="add remove"
|
options="add remove"
|
||||||
else
|
else
|
||||||
|
if [[ "${COMP_WORDS[1]}" != "all" ]]; then
|
||||||
case "${COMP_WORDS[4]}" in
|
case "${COMP_WORDS[4]}" in
|
||||||
remove)
|
remove)
|
||||||
if [[ $COMP_CWORD -ge 5 ]]; then
|
if [[ $COMP_CWORD -ge 5 ]]; then
|
||||||
@ -217,11 +224,13 @@ _msm() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
ip)
|
ip)
|
||||||
if [[ $COMP_CWORD == 4 ]]; then
|
if [[ $COMP_CWORD == 4 ]]; then
|
||||||
options="add remove"
|
options="add remove"
|
||||||
else
|
else
|
||||||
|
if [[ "${COMP_WORDS[1]}" != "all" ]]; then
|
||||||
case "${COMP_WORDS[4]}" in
|
case "${COMP_WORDS[4]}" in
|
||||||
remove)
|
remove)
|
||||||
if [[ $COMP_CWORD -ge 5 ]]; then
|
if [[ $COMP_CWORD -ge 5 ]]; then
|
||||||
@ -233,6 +242,7 @@ _msm() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
@ -241,6 +251,7 @@ _msm() {
|
|||||||
if [[ $COMP_CWORD == 3 ]]; then
|
if [[ $COMP_CWORD == 3 ]]; then
|
||||||
options="add remove list"
|
options="add remove list"
|
||||||
else
|
else
|
||||||
|
if [[ "${COMP_WORDS[1]}" != "all" ]]; then
|
||||||
case "${COMP_WORDS[3]}" in
|
case "${COMP_WORDS[3]}" in
|
||||||
remove)
|
remove)
|
||||||
if [[ $COMP_CWORD -ge 4 ]]; then
|
if [[ $COMP_CWORD -ge 4 ]]; then
|
||||||
@ -252,6 +263,7 @@ _msm() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
gamemode|gm)
|
gamemode|gm)
|
||||||
if [[ $COMP_CWORD == 3 ]]; then
|
if [[ $COMP_CWORD == 3 ]]; then
|
||||||
@ -270,9 +282,11 @@ _msm() {
|
|||||||
;;
|
;;
|
||||||
config)
|
config)
|
||||||
if [[ $COMP_CWORD == 3 ]]; then
|
if [[ $COMP_CWORD == 3 ]]; then
|
||||||
|
if [[ "${COMP_WORDS[1]}" != "all" ]]; then
|
||||||
server_property "$sid" SERVER_CONF
|
server_property "$sid" SERVER_CONF
|
||||||
options="$(more "${SERVER_CONF[$sid]}" | sed 's/=.*$//' | grep -v '#')";
|
options="$(more "${SERVER_CONF[$sid]}" | sed 's/=.*$//' | grep -v '#')";
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user