mirror of
https://github.com/jimeh/dotify.git
synced 2026-02-19 10:06:39 +00:00
Remove dotfile option parsing commands
They are no longer needed, as I'm going for a "compile Dotfile to regular shell script" approach now, rather than a "manually parse the shit out of the Dotfile".
This commit is contained in:
@@ -43,7 +43,6 @@ source "../lib/internals/create-symlink.sh"
|
||||
source "../lib/internals/execute-dotfile.sh"
|
||||
source "../lib/internals/locate-dotfile.sh"
|
||||
source "../lib/internals/locate-target.sh"
|
||||
source "../lib/internals/parse-dotfile-options.sh"
|
||||
|
||||
#
|
||||
# Command functions
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
# Parse Dotfile options and set relevant global variables.
|
||||
parse-dotfile-options() {
|
||||
DOTIFY_OPT_ROOT_LINK="$(parse-dotfile-root_link-option)"
|
||||
DOTIFY_OPT_DEFAULT_ACTION="$(parse-dotfile-default_action-option)"
|
||||
}
|
||||
|
||||
# Parse root_link option.
|
||||
parse-dotfile-root_link-option() {
|
||||
echo "$(parse-dotfile-option "root_link" ".dotfiles" "$1")"
|
||||
}
|
||||
|
||||
# Parse default_action option.
|
||||
parse-dotfile-default_action-option() {
|
||||
echo "$(parse-dotfile-option "default_action" "link" "$1")"
|
||||
}
|
||||
|
||||
# Extract a specific option from Dotfile.
|
||||
#
|
||||
# Arguments:
|
||||
# - $1: Name of option to extract.
|
||||
# - $2: (optional) Default value of option if not present in Dotfile.
|
||||
# - $3: (optional) Specific Dotfile to read. Uses $DOTFILE if empty.
|
||||
#
|
||||
parse-dotfile-option() {
|
||||
local name="$1"
|
||||
local value="$2"
|
||||
local dotfile="$3"
|
||||
if [ -z "$dotfile" ]; then dotfile="$DOTFILE"; fi
|
||||
|
||||
local line=""
|
||||
while read line; do
|
||||
if [[ "$line" == "$name "* ]]; then
|
||||
value="$(trim "${line/#$name }")"
|
||||
break
|
||||
fi
|
||||
done < "$dotfile"
|
||||
|
||||
echo "$value"
|
||||
}
|
||||
Reference in New Issue
Block a user