mirror of
https://github.com/jimeh/dotify.git
synced 2026-02-19 10:06:39 +00:00
Add Dotfile commands
This commit is contained in:
@@ -48,6 +48,7 @@ source "../lib/internals/locate-target.sh"
|
|||||||
# Command functions
|
# Command functions
|
||||||
#
|
#
|
||||||
|
|
||||||
|
source "../lib/dotify-action.sh"
|
||||||
source "../lib/dotify-clean.sh"
|
source "../lib/dotify-clean.sh"
|
||||||
source "../lib/dotify-compile.sh"
|
source "../lib/dotify-compile.sh"
|
||||||
source "../lib/dotify-help.sh"
|
source "../lib/dotify-help.sh"
|
||||||
@@ -63,6 +64,21 @@ source "../lib/dotify-version.sh"
|
|||||||
source "../plugins/link.sh"
|
source "../plugins/link.sh"
|
||||||
source "../plugins/git.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
|
# Argument Parsing
|
||||||
#
|
#
|
||||||
|
|||||||
3
src/lib/dotfile-commands/default_action.sh
Normal file
3
src/lib/dotfile-commands/default_action.sh
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
default_action() {
|
||||||
|
DOTIFY_OPT_DEFAULT_ACTION="$@"
|
||||||
|
}
|
||||||
3
src/lib/dotfile-commands/include.sh
Normal file
3
src/lib/dotfile-commands/include.sh
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
include() {
|
||||||
|
echo "include: $@"
|
||||||
|
}
|
||||||
3
src/lib/dotfile-commands/root_link.sh
Normal file
3
src/lib/dotfile-commands/root_link.sh
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
root_link () {
|
||||||
|
DOTIFY_OPT_ROOT_LINK="$@"
|
||||||
|
}
|
||||||
14
test/lib/dotfile-commands/default_action-test.sh
Executable file
14
test/lib/dotfile-commands/default_action-test.sh
Executable 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()"
|
||||||
14
test/lib/dotfile-commands/root_link-test.sh
Executable file
14
test/lib/dotfile-commands/root_link-test.sh
Executable 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()"
|
||||||
Reference in New Issue
Block a user