mirror of
https://github.com/msmhq/msm.git
synced 2024-08-30 18:12:35 +00:00
Reverted spellings identified as correct in comments
Reverted upper-case to uppercase; lower-case to lowercase; and time-stamp to timestamp.
This commit is contained in:
parent
7578a9e34c
commit
03f36ec777
22
init/msm
22
init/msm
@ -177,16 +177,16 @@ is_bash_version() {
|
|||||||
# Converts a string to be ready for use as a global
|
# Converts a string to be ready for use as a global
|
||||||
# variable name.
|
# variable name.
|
||||||
# $1: The string to convert
|
# $1: The string to convert
|
||||||
# RETURN: The name in upper-case and with underscores
|
# RETURN: The name in uppercase and with underscores
|
||||||
to_global_name() {
|
to_global_name() {
|
||||||
unset RETURN
|
unset RETURN
|
||||||
# Translate to upper-case, and replace dashes with underscores
|
# Translate to uppercase, and replace dashes with underscores
|
||||||
local result="$1"
|
local result="$1"
|
||||||
if is_bash_version 4; then
|
if is_bash_version 4; then
|
||||||
# Much faster than the `tr` command
|
# Much faster than the `tr` command
|
||||||
result="${result//-/_}"
|
result="${result//-/_}"
|
||||||
result="${result//./_}"
|
result="${result//./_}"
|
||||||
result="${result^^}" # to upper-case
|
result="${result^^}" # to uppercase
|
||||||
else
|
else
|
||||||
result="$(echo "$result" | tr '[\-\.a-z]' '[\_\_A-Z]')"
|
result="$(echo "$result" | tr '[\-\.a-z]' '[\_\_A-Z]')"
|
||||||
fi
|
fi
|
||||||
@ -197,15 +197,15 @@ to_global_name() {
|
|||||||
# Converts a global BASH variable name to a server.properties file
|
# Converts a global BASH variable name to a server.properties file
|
||||||
# variable name.
|
# variable name.
|
||||||
# $1: The string to convert
|
# $1: The string to convert
|
||||||
# RETURN: The name in lower-case and with dashes
|
# RETURN: The name in lowercase and with dashes
|
||||||
to_properties_name() {
|
to_properties_name() {
|
||||||
unset RETURN
|
unset RETURN
|
||||||
# Translate to upper-case, and replace dashes with underscores
|
# Translate to uppercase, and replace dashes with underscores
|
||||||
local result="$1"
|
local result="$1"
|
||||||
if is_bash_version 4; then
|
if is_bash_version 4; then
|
||||||
# Much faster than the `tr` command
|
# Much faster than the `tr` command
|
||||||
result="${result//_/-}"
|
result="${result//_/-}"
|
||||||
result="${result,,}" # to lower-case
|
result="${result,,}" # to lowercase
|
||||||
else
|
else
|
||||||
result="$(echo "$result" | tr '[\_A-Z]' '[\-a-z]')"
|
result="$(echo "$result" | tr '[\_A-Z]' '[\-a-z]')"
|
||||||
fi
|
fi
|
||||||
@ -283,7 +283,7 @@ get_latest_file() {
|
|||||||
RETURN="$best_file"
|
RETURN="$best_file"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Returns the current time as a UNIX time stamp (in seconds since 1970)
|
# Returns the current time as a UNIX timestamp (in seconds since 1970)
|
||||||
now() {
|
now() {
|
||||||
date +%s
|
date +%s
|
||||||
}
|
}
|
||||||
@ -291,7 +291,7 @@ now() {
|
|||||||
|
|
||||||
### Log Utility Functions
|
### Log Utility Functions
|
||||||
|
|
||||||
# Gets the UNIX time-stamp for a server log line
|
# Gets the UNIX timestamp for a server log line
|
||||||
# $1: A server log line
|
# $1: A server log line
|
||||||
# returns: Time in seconds since 1970-01-01 00:00:00 UTC
|
# returns: Time in seconds since 1970-01-01 00:00:00 UTC
|
||||||
log_line_get_time() {
|
log_line_get_time() {
|
||||||
@ -649,7 +649,7 @@ server_ensure_jar() {
|
|||||||
# $2: The setting name to read
|
# $2: The setting name to read
|
||||||
server_read_config() {
|
server_read_config() {
|
||||||
unset RETURN
|
unset RETURN
|
||||||
# Convert name into upper-case with underscores
|
# Convert name into uppercase with underscores
|
||||||
# msm-setting => SERVER_SETTING
|
# msm-setting => SERVER_SETTING
|
||||||
# setting => SERVER_PROPERTIES_SETTING
|
# setting => SERVER_PROPERTIES_SETTING
|
||||||
if [[ "$2" =~ ^msm\-(.*)$ ]]; then
|
if [[ "$2" =~ ^msm\-(.*)$ ]]; then
|
||||||
@ -800,7 +800,7 @@ server_worlds_to_disk() {
|
|||||||
|
|
||||||
# Watches a server's log for a specific line
|
# Watches a server's log for a specific line
|
||||||
# $1: The ID for the server
|
# $1: The ID for the server
|
||||||
# $2: A UNIX time stamp (seconds since 1970) which the $3 line must be after
|
# $2: A UNIX timestamp (seconds since 1970) which the $3 line must be after
|
||||||
# $3: The regex that matches log lines
|
# $3: The regex that matches log lines
|
||||||
# $4: A timeout in seconds
|
# $4: A timeout in seconds
|
||||||
# returns: When the line is found
|
# returns: When the line is found
|
||||||
@ -834,7 +834,7 @@ server_log_get_line() {
|
|||||||
# The same as server_log_get_line, but prints a dot instead of the log line
|
# The same as server_log_get_line, but prints a dot instead of the log line
|
||||||
# to stdout, and returns when line is found.
|
# to stdout, and returns when line is found.
|
||||||
# $1: the ID of the server
|
# $1: the ID of the server
|
||||||
# $2: A UNIX time stamp (seconds since 1970) which the $3 line must be after
|
# $2: A UNIX timestamp (seconds since 1970) which the $3 line must be after
|
||||||
# $3: The regex that matches log lines
|
# $3: The regex that matches log lines
|
||||||
# $4: A timeout in seconds
|
# $4: A timeout in seconds
|
||||||
# returns: When the line is found
|
# returns: When the line is found
|
||||||
|
Loading…
Reference in New Issue
Block a user