diff --git a/src/bin/dotify b/src/bin/dotify index 74ed474..914d2cc 100755 --- a/src/bin/dotify +++ b/src/bin/dotify @@ -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 # diff --git a/src/lib/dotfile-commands/default_action.sh b/src/lib/dotfile-commands/default_action.sh new file mode 100644 index 0000000..29dd19a --- /dev/null +++ b/src/lib/dotfile-commands/default_action.sh @@ -0,0 +1,3 @@ +default_action() { + DOTIFY_OPT_DEFAULT_ACTION="$@" +} diff --git a/src/lib/dotfile-commands/include.sh b/src/lib/dotfile-commands/include.sh new file mode 100644 index 0000000..652ad65 --- /dev/null +++ b/src/lib/dotfile-commands/include.sh @@ -0,0 +1,3 @@ +include() { + echo "include: $@" +} diff --git a/src/lib/dotfile-commands/root_link.sh b/src/lib/dotfile-commands/root_link.sh new file mode 100644 index 0000000..8c99358 --- /dev/null +++ b/src/lib/dotfile-commands/root_link.sh @@ -0,0 +1,3 @@ +root_link () { + DOTIFY_OPT_ROOT_LINK="$@" +} diff --git a/test/lib/dotfile-commands/default_action-test.sh b/test/lib/dotfile-commands/default_action-test.sh new file mode 100755 index 0000000..89b4261 --- /dev/null +++ b/test/lib/dotfile-commands/default_action-test.sh @@ -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()" diff --git a/test/lib/dotfile-commands/root_link-test.sh b/test/lib/dotfile-commands/root_link-test.sh new file mode 100755 index 0000000..2083da3 --- /dev/null +++ b/test/lib/dotfile-commands/root_link-test.sh @@ -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()"