Browse Source

added updated options messages

Updated all options messages and added short switches for my convenience
pull/520/head
Daniel Gibbs 10 years ago
parent
commit
4a151c3d17
  1. 406
      functions/fn_getopt

406
functions/fn_getopt

@ -2,301 +2,397 @@
# LGSM fn_getopt function # LGSM fn_getopt function
# Author: Daniel Gibbs # Author: Daniel Gibbs
# Website: http://gameservermanagers.com # Website: http://gameservermanagers.com
# Version: 301015 # Version: 011115
# Description: getopt arguments. # Description: getopt arguments.
fn_getopt_generic(){ fn_getopt_generic(){
case "$getopt" in case "$getopt" in
start) st|start)
fn_start;; fn_start;;
stop) sp|stop)
fn_stop;; fn_stop;;
restart) r|restart)
fn_restart;; fn_restart;;
update) u|update)
fn_update_check;; fn_update_check;;
force-update) fu|force-update|update-restart)
forceupdate=1; forceupdate=1;
fn_update_check;; fn_update_check;;
update-restart) uf|update-functions)
forceupdate=1;
fn_update_check;;
update-functions)
fn_update_functions;; fn_update_functions;;
validate) v|validate)
fn_validate;; fn_validate;;
monitor) m|monitor)
fn_monitor;; fn_monitor;;
email-test) et|email-test)
fn_email_test;; fn_email_test;;
details) d|details)
fn_details;; fn_details;;
backup) b|backup)
fn_backup;; fn_backup;;
console) c|console)
fn_console;; fn_console;;
debug) d|debug)
fn_debug;; fn_debug;;
install) i|install)
fn_install;; fn_install;;
auto-install) ai|auto-install)
fn_autoinstall;; fn_autoinstall;;
depsdetect) dd|depsdetect)
fn_deps_detect;; fn_deps_detect;;
*) *)
echo "Usage: $0 {start|stop|restart|update|force-update|update-functions|validate|monitor|email-test|details|backup|console|debug|install|auto-install}" echo "Usage: $0 [option]"
exit 1;; echo "${gamename} - Linux Game Server Manager - Version ${version}"
esac echo "http://gameservermanagers.com/${selfname}"
echo -e ""
echo -e "\e[93mCommands\e[0m"
{
echo -e "\e[34mstart\t\e[0mStart the server."
echo -e "\e[34mstop\t\e[0mStop the server."
echo -e "\e[34mrestart\t\e[0mRestart the server."
echo -e "\e[34mupdate\t\e[0mChecks and applies updates from SteamCMD."
echo -e "\e[34mforce-update\t\e[0mBypasses the check and applies updates from SteamCMD."
echo -e "\e[34mupdate-functions\t\e[0mRemoves all functions so latest can be downloaded."
echo -e "\e[34mvalidate\t\e[0mValidate server files with SteamCMD."
echo -e "\e[34mmonitor\t\e[0mChecks that the server is running."
echo -e "\e[34memail-test\t\e[0mSends test monitor email."
echo -e "\e[34mdetails\t\e[0mDisplays useful infomation about the server."
echo -e "\e[34mbackup\t\e[0mCreate archive of the server."
echo -e "\e[34mconsole\t\e[0mConsole allows you to access the live view of a server."
echo -e "\e[34mdebug\t\e[0mSee the output of the server directly to your terminal."
echo -e "\e[34minstall\t\e[0mInstall the server."
echo -e "\e[34mauto-install\t\e[0mInstall the server, without prompts."
} | column -s $'\t' -t
esac
exit exit
} }
fn_getopt_teamspeak3(){ fn_getopt_teamspeak3(){
case "$getopt" in case "$getopt" in
start) st|start)
fn_start;; fn_start;;
stop) sp|stop)
fn_stop;; fn_stop;;
restart) r|restart)
fn_restart;; fn_restart;;
update) u|update)
fn_update_check;; fn_update_check;;
update-functions) uf|update-functions)
fn_update_functions;; fn_update_functions;;
monitor) m|monitor)
fn_monitor;; fn_monitor;;
email-test) et|email-test)
fn_email_test;; fn_email_test;;
details) d|details)
fn_details;; fn_details;;
backup) b|backup)
fn_backup;; fn_backup;;
install) i|install)
fn_install;; fn_install;;
auto-install) ai|auto-install)
fn_autoinstall;; fn_autoinstall;;
depsdetect) dd|depsdetect)
fn_deps_detect;; fn_deps_detect;;
*) *)
echo "Usage: $0 {start|stop|restart|update|update-functions|monitor|email-test|details|backup|install|auto-install}" echo "Usage: $0 [option]"
exit 1;; echo "${gamename} - Linux Game Server Manager - Version ${version}"
esac echo "http://gameservermanagers.com/${selfname}"
echo -e ""
echo -e "\e[93mCommands\e[0m"
{
echo -e "\e[34mstart\t\e[0mStart the server."
echo -e "\e[34mstop\t\e[0mStop the server."
echo -e "\e[34mrestart\t\e[0mRestart the server."
echo -e "\e[34mupdate\t\e[0mChecks and applies updates from teamspeak.com."
echo -e "\e[34mupdate-functions\t\e[0mRemoves all functions so latest can be downloaded."
echo -e "\e[34mmonitor\t\e[0mChecks that the server is running."
echo -e "\e[34memail-test\t\e[0mSends test monitor email."
echo -e "\e[34mdetails\t\e[0mDisplays useful infomation about the server."
echo -e "\e[34mbackup\t\e[0mCreate archive of the server."
echo -e "\e[34minstall\t\e[0mInstall the server."
echo -e "\e[34mauto-install\t\e[0mInstall the server, without prompts."
} | column -s $'\t' -t
esac
exit exit
} }
fn_getopt_mumble(){ fn_getopt_mumble(){
case "$getopt" in case "$getopt" in
start) st|start)
fn_start;; fn_start;;
stop) sp|stop)
fn_stop;; fn_stop;;
restart) r|restart)
fn_restart;; fn_restart;;
update-functions) uf|update-functions)
fn_update_functions;; fn_update_functions;;
monitor) m|monitor)
fn_monitor;; fn_monitor;;
email-test) et|email-test)
fn_email_test;; fn_email_test;;
backup) b|backup)
fn_backup;; fn_backup;;
console) console)
fn_console;; fn_console;;
debug) d|debug)
fn_debug;; fn_debug;;
depsdetect) dd|depsdetect)
fn_deps_detect;; fn_deps_detect;;
*) *)
echo "Usage: $0 {start|stop|restart|update-functions|monitor|email-test|backup|console|debug}" echo "Usage: $0 [option]"
exit 1;; echo "${gamename} - Linux Game Server Manager - Version ${version}"
esac echo "http://gameservermanagers.com/${selfname}"
echo -e ""
echo -e "\e[93mCommands\e[0m"
{
echo -e "\e[34mstart\t\e[0mStart the server."
echo -e "\e[34mstop\t\e[0mStop the server."
echo -e "\e[34mrestart\t\e[0mRestart the server."
echo -e "\e[34mupdate-functions\t\e[0mRemoves all functions so latest can be downloaded."
echo -e "\e[34mmonitor\t\e[0mChecks that the server is running."
echo -e "\e[34memail-test\t\e[0mSends test monitor email."
echo -e "\e[34mbackup\t\e[0mCreate archive of the server."
echo -e "\e[34mconsole\t\e[0mConsole allows you to access the live view of a server."
echo -e "\e[34mdebug\t\e[0mSee the output of the server directly to your terminal."
} | column -s $'\t' -t
esac
exit exit
} }
fn_getopt_gmodserver(){ fn_getopt_gmodserver(){
case "$getopt" in case "$getopt" in
start) st|start)
fn_start;; fn_start;;
stop) sp|stop)
fn_stop;; fn_stop;;
restart) r|restart)
fn_restart;; fn_restart;;
update) u|update)
fn_update_check;; fn_update_check;;
force-update|update-restart) fu|force-update|update-restart)
forceupdate=1; forceupdate=1;
fn_update_check;; fn_update_check;;
update-functions|updatefunctions) uf|update-functions)
fn_update_functions;; fn_update_functions;;
validate) v|validate)
fn_validate;; fn_validate;;
monitor) m|monitor)
fn_monitor;; fn_monitor;;
email-test|emailtest) et|email-test)
fn_email_test;; fn_email_test;;
details) d|details)
fn_details;; fn_details;;
backup) b|backup)
fn_backup;; fn_backup;;
console) c|console)
fn_console;; fn_console;;
debug) d|debug)
fn_debug;; fn_debug;;
install) i|install)
fn_install;; fn_install;;
auto-install|autoinstall) ai|auto-install)
fn_autoinstall;; fn_autoinstall;;
content) dd|depsdetect)
echo fn_deps_detect;;
gc|gmod-content)
fn_content_gmod;; fn_content_gmod;;
depsdetect)
fn_deps_detect;;
*) *)
echo "Usage: $0 [option] echo "Usage: $0 [option]"
echo "${gamename} - Linux Game Server Manager - Version ${version}"
${gamename} - Linux Game Server Manager - Version ${version} echo "http://gameservermanagers.com/${selfname}"
http://gameservermanagers.com/${selfname}" echo -e ""
echo -e "" echo -e "\e[93mCommands\e[0m"
echo -e "\e[93mCommands\e[0m" {
echo -e "\e[34mstart\t\e[0mStart the server."
{ echo -e "\e[34mstop\t\e[0mStop the server."
echo -e "\e[34mstart\t\e[0mStart the server." echo -e "\e[34mrestart\t\e[0mRestart the server."
echo -e "\e[34mstop\t\e[0mStop the server." echo -e "\e[34mupdate\t\e[0mChecks and applies updates from SteamCMD."
echo -e "\e[34mrestart\t\e[0mRestart the server." echo -e "\e[34mforce-update\t\e[0mBypasses the check and applies updates from SteamCMD."
echo -e "\e[34mupdate\t\e[0mChecks and applies updates from SteamCMD." echo -e "\e[34mupdate-functions\t\e[0mRemoves all functions so latest can be downloaded."
echo -e "\e[34mforce-update\t\e[0mBypasses the check and applies updates from SteamCMD." echo -e "\e[34mvalidate\t\e[0mValidate server files with SteamCMD."
echo -e "\e[34mupdate-functions\t\e[0mRemoves all functions so latest can be downloaded." echo -e "\e[34mmonitor\t\e[0mChecks that the server is running."
echo -e "\e[34mvalidate\t\e[0mValidate server files with SteamCMD." echo -e "\e[34memail-test\t\e[0mSends test monitor email."
echo -e "\e[34mmonitor\t\e[0mChecks that the server is running." echo -e "\e[34mdetails\t\e[0mDisplays useful infomation about the server."
echo -e "\e[34mdetails\t\e[0mDisplays useful infomation about the server." echo -e "\e[34mbackup\t\e[0mCreate archive of the server."
echo -e "\e[34mbackup\t\e[0mCreate archive of the server." echo -e "\e[34mconsole\t\e[0mConsole allows you to access the live view of a server."
echo -e "\e[34mconsole\t\e[0mConsole allows you to access the live view of a server." echo -e "\e[34mdebug\t\e[0mSee the output of the server directly to your terminal."
echo -e "\e[34mdebug\t\e[0mSee the output of the server directly to your terminal." echo -e "\e[34minstall\t\e[0mInstall the server."
echo -e "\e[34minstall\t\e[0mInstall the server." echo -e "\e[34mauto-install\t\e[0mInstall the server, without prompts."
echo -e "\e[34mauto-install\t\e[0mInstall the server, without prompts." echo -e "\e[34mgmod-content\t\e[0mDownload gmod add-on content."
echo -e "\e[34mgmod-content\t\e[0mDownload gmod add-on content." } | column -s $'\t' -t
esac
} | column -s $'\t' -t
esac
exit exit
} }
fn_getopt_unreal(){ fn_getopt_unreal(){
case "$getopt" in case "$getopt" in
start) st|start)
fn_start;; fn_start;;
stop) sp|stop)
fn_stop;; fn_stop;;
restart) r|restart)
fn_restart;; fn_restart;;
update-functions) uf|update-functions)
fn_update_functions;; fn_update_functions;;
monitor) m|monitor)
fn_monitor;; fn_monitor;;
email-test) et|email-test)
fn_email_test;; fn_email_test;;
details) d|details)
fn_details;; fn_details;;
backup) b|backup)
fn_backup;; fn_backup;;
console) c|console)
fn_console;; fn_console;;
debug) d|debug)
fn_debug;; fn_debug;;
install) i|install)
fn_install;; fn_install;;
map-compressor) mc|map-compressor)
fn_compress_ut99maps;; fn_compress_ut99maps;;
depsdetect) dd|depsdetect)
fn_deps_detect;; fn_deps_detect;;
*) *)
echo "Usage: $0 {start|stop|restart|update-functions|monitor|email-test|details|backup|console|debug|install|map-compressor}" echo "Usage: $0 [option]"
exit 1;; echo "${gamename} - Linux Game Server Manager - Version ${version}"
esac echo "http://gameservermanagers.com/${selfname}"
echo -e ""
echo -e "\e[93mCommands\e[0m"
{
echo -e "\e[34mstart\t\e[0mStart the server."
echo -e "\e[34mstop\t\e[0mStop the server."
echo -e "\e[34mrestart\t\e[0mRestart the server."
echo -e "\e[34mupdate-functions\t\e[0mRemoves all functions so latest can be downloaded."
echo -e "\e[34mmonitor\t\e[0mChecks that the server is running."
echo -e "\e[34memail-test\t\e[0mSends test monitor email."
echo -e "\e[34mdetails\t\e[0mDisplays useful infomation about the server."
echo -e "\e[34mbackup\t\e[0mCreate archive of the server."
echo -e "\e[34mconsole\t\e[0mConsole allows you to access the live view of a server."
echo -e "\e[34mdebug\t\e[0mSee the output of the server directly to your terminal."
echo -e "\e[34minstall\t\e[0mInstall the server."
echo -e "\e[34mmap-compressor\t\e[0mCompresses all ${gamename} server maps."
} | column -s $'\t' -t
esac
exit exit
} }
fn_getopt_unreal2(){ fn_getopt_unreal2(){
case "$getopt" in case "$getopt" in
start) st|start)
fn_start;; fn_start;;
stop) sp|stop)
fn_stop;; fn_stop;;
restart) r|restart)
fn_restart;; fn_restart;;
update) u|update)
fn_update_check;; fn_update_check;;
force-update) fu|force-update|update-restart)
forceupdate=1; forceupdate=1;
fn_update_check;; fn_update_check;;
update-restart) uf|update-functions)
forceupdate=1;
fn_update_check;;
update-functions)
fn_update_functions;; fn_update_functions;;
validate) v|validate)
fn_validate;; fn_validate;;
monitor) m|monitor)
fn_monitor;; fn_monitor;;
email-test) et|email-test)
fn_email_test;; fn_email_test;;
details) d|details)
fn_details;; fn_details;;
backup) b|backup)
fn_backup;; fn_backup;;
console) c|console)
fn_console;; fn_console;;
debug) d|debug)
fn_debug;; fn_debug;;
install) i|install)
fn_install;; fn_install;;
auto-install) ai|auto-install)
fn_autoinstall;; fn_autoinstall;;
map-compressor) dd|depsdetect)
fn_deps_detect;;
mc|map-compressor)
fn_compress_unreal2maps;; fn_compress_unreal2maps;;
depsdetect)
fn_deps_detect;;
*) *)
echo "Usage: $0 {start|stop|restart|update|update-functions|validate|monitor|email-test|details|backup|console|debug|install|auto-install|map-compressor}" echo "Usage: $0 [option]"
exit 1;; echo "${gamename} - Linux Game Server Manager - Version ${version}"
esac echo "http://gameservermanagers.com/${selfname}"
echo -e ""
echo -e "\e[93mCommands\e[0m"
{
echo -e "\e[34mstart\t\e[0mStart the server."
echo -e "\e[34mstop\t\e[0mStop the server."
echo -e "\e[34mrestart\t\e[0mRestart the server."
echo -e "\e[34mupdate\t\e[0mChecks and applies updates from SteamCMD."
echo -e "\e[34mforce-update\t\e[0mBypasses the check and applies updates from SteamCMD."
echo -e "\e[34mupdate-functions\t\e[0mRemoves all functions so latest can be downloaded."
echo -e "\e[34mvalidate\t\e[0mValidate server files with SteamCMD."
echo -e "\e[34mmonitor\t\e[0mChecks that the server is running."
echo -e "\e[34memail-test\t\e[0mSends test monitor email."
echo -e "\e[34mdetails\t\e[0mDisplays useful infomation about the server."
echo -e "\e[34mbackup\t\e[0mCreate archive of the server."
echo -e "\e[34mconsole\t\e[0mConsole allows you to access the live view of a server."
echo -e "\e[34mdebug\t\e[0mSee the output of the server directly to your terminal."
echo -e "\e[34minstall\t\e[0mInstall the server."
echo -e "\e[34mauto-install\t\e[0mInstall the server, without prompts."
echo -e "\e[34mmap-compressor\t\e[0mCompresses all ${gamename} server maps."
} | column -s $'\t' -t
esac
exit exit
} }
fn_getopt_ut2k4(){ fn_getopt_ut2k4(){
case "$getopt" in case "$getopt" in
start) st|start)
fn_start;; fn_start;;
stop) sp|stop)
fn_stop;; fn_stop;;
restart) r|restart)
fn_restart;; fn_restart;;
update-functions) uf|update-functions)
fn_update_functions;; fn_update_functions;;
monitor) m|monitor)
fn_monitor;; fn_monitor;;
email-test) et|email-test)
fn_email_test;; fn_email_test;;
details) d|details)
fn_details;; fn_details;;
backup) b|backup)
fn_backup;; fn_backup;;
console) c|console)
fn_console;; fn_console;;
debug) d|debug)
fn_debug;; fn_debug;;
install) i|install)
fn_install;; fn_install;;
map-compressor) mc|map-compressor)
fn_compress_unreal2maps;; fn_compress_ut99maps;;
depsdetect) dd|depsdetect)
fn_deps_detect;; fn_deps_detect;;
*) *)
echo "Usage: $0 {start|stop|restart|update-functions|monitor|email-test|details|backup|console|debug|install|map-compressor}" echo "Usage: $0 [option]"
exit 1;; echo "${gamename} - Linux Game Server Manager - Version ${version}"
esac echo "http://gameservermanagers.com/${selfname}"
echo -e ""
echo -e "\e[93mCommands\e[0m"
{
echo -e "\e[34mstart\t\e[0mStart the server."
echo -e "\e[34mstop\t\e[0mStop the server."
echo -e "\e[34mrestart\t\e[0mRestart the server."
echo -e "\e[34mupdate-functions\t\e[0mRemoves all functions so latest can be downloaded."
echo -e "\e[34mmonitor\t\e[0mChecks that the server is running."
echo -e "\e[34memail-test\t\e[0mSends test monitor email."
echo -e "\e[34mdetails\t\e[0mDisplays useful infomation about the server."
echo -e "\e[34mbackup\t\e[0mCreate archive of the server."
echo -e "\e[34mconsole\t\e[0mConsole allows you to access the live view of a server."
echo -e "\e[34mdebug\t\e[0mSee the output of the server directly to your terminal."
echo -e "\e[34minstall\t\e[0mInstall the server."
echo -e "\e[34mmap-compressor\t\e[0mCompresses all ${gamename} server maps."
} | column -s $'\t' -t
esac
exit exit
} }

Loading…
Cancel
Save