mirror of https://github.com/sbt/sbt.git
Use built-in bash string trimming instead of sed.
This commit is contained in:
parent
678fe9d204
commit
087770f5e0
12
sbt
12
sbt
|
|
@ -89,6 +89,14 @@ cygwinpath() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Trim leading and trailing spaces from a string.
|
||||||
|
# Echos the new trimmed string.
|
||||||
|
trimString() {
|
||||||
|
local inputStr="$*"
|
||||||
|
local modStr="${inputStr#"${inputStr%%[![:space:]]*}"}"
|
||||||
|
modStr="${modStr%"${modStr##*[![:space:]]}"}"
|
||||||
|
echo "$modStr"
|
||||||
|
}
|
||||||
|
|
||||||
declare -r sbt_bin_dir="$(dirname "$(realpathish "$0")")"
|
declare -r sbt_bin_dir="$(dirname "$(realpathish "$0")")"
|
||||||
declare -r sbt_home="$(dirname "$sbt_bin_dir")"
|
declare -r sbt_home="$(dirname "$sbt_bin_dir")"
|
||||||
|
|
@ -708,8 +716,8 @@ loadConfigFile() {
|
||||||
|
|
||||||
loadPropFile() {
|
loadPropFile() {
|
||||||
# trim key and value so as to be more forgiving with spaces around the '=':
|
# trim key and value so as to be more forgiving with spaces around the '=':
|
||||||
k=$(echo $k |sed -e 's/^\s*(.+)\s*$/\\1/g')
|
k=$(trimString $k)
|
||||||
v=$(echo $v |sed -e 's/^\s*(.+)\s*$/\\1/g')
|
v=$(trimString $v)
|
||||||
while IFS='=' read -r k v; do
|
while IFS='=' read -r k v; do
|
||||||
if [[ "$k" == "sbt.version" ]]; then
|
if [[ "$k" == "sbt.version" ]]; then
|
||||||
build_props_sbt_version="$v"
|
build_props_sbt_version="$v"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue