Add Dotfile commands

This commit is contained in:
2013-10-21 00:01:02 +01:00
parent f5725f6229
commit 65ccec0d8a
6 changed files with 53 additions and 0 deletions

View File

@@ -48,6 +48,7 @@ source "../lib/internals/locate-target.sh"
# Command functions
#
source "../lib/dotify-action.sh"
source "../lib/dotify-clean.sh"
source "../lib/dotify-compile.sh"
source "../lib/dotify-help.sh"
@@ -63,6 +64,21 @@ source "../lib/dotify-version.sh"
source "../plugins/link.sh"
source "../plugins/git.sh"
#
# Dotfile commands
#
source "../lib/dotfile-commands/root_link.sh"
source "../lib/dotfile-commands/default_action.sh"
source "../lib/dotfile-commands/include.sh"
#
# Default Options
#
DOTIFY_OPT_ROOT_LINK=".dotfiles"
DOTIFY_OPT_DEFAULT_ACTION="link"
#
# Argument Parsing
#

View File

@@ -0,0 +1,3 @@
default_action() {
DOTIFY_OPT_DEFAULT_ACTION="$@"
}

View File

@@ -0,0 +1,3 @@
include() {
echo "include: $@"
}

View File

@@ -0,0 +1,3 @@
root_link () {
DOTIFY_OPT_ROOT_LINK="$@"
}

View File

@@ -0,0 +1,14 @@
#! /usr/bin/env bash
source "../../test-helper.sh"
source "../../../src/lib/dotfile-commands/default_action.sh"
#
# root_link() tests
#
# Sets DOTIFY_OPT_DEFAULT_ACTION
default_action foo
assert 'echo $DOTIFY_OPT_DEFAULT_ACTION' 'foo'
default_action foo bar
assert 'echo $DOTIFY_OPT_DEFAULT_ACTION' 'foo bar'
assert_end "root_link()"

View File

@@ -0,0 +1,14 @@
#! /usr/bin/env bash
source "../../test-helper.sh"
source "../../../src/lib/dotfile-commands/root_link.sh"
#
# root_link() tests
#
# Sets DOTIFY_OPT_ROOT_LINK
root_link .dots
assert 'echo $DOTIFY_OPT_ROOT_LINK' '.dots'
root_link my dots
assert 'echo $DOTIFY_OPT_ROOT_LINK' 'my dots'
assert_end "root_link()"