Break main dotify binary apart into smaller pieces for easier testing

The plan is to have a build script that will put together all files into
a single executable again for easy inclusion in your own
dotfiles. Breaking dotify apart simply makes it easier to work with and
test.
This commit is contained in:
2013-06-26 21:25:26 +02:00
parent 30e7c1e16f
commit 21a0f78f41
9 changed files with 320 additions and 0 deletions

13
src/lib/trim.sh Normal file
View File

@@ -0,0 +1,13 @@
# Trim leading and trailing whitespace.
#
# Example:
#
# $ trim " foo bar "
# foo bar
#
trim() {
local string="$@"
string="${string#"${string%%[![:space:]]*}"}"
string="${string%"${string##*[![:space:]]}"}"
echo -n "$string"
}