Added
This commit is contained in:
parent
905bd61241
commit
4071563a9c
1 changed files with 46 additions and 0 deletions
46
scripts/dotfiles.sh
Executable file
46
scripts/dotfiles.sh
Executable file
|
@ -0,0 +1,46 @@
|
|||
#!/bin/bash
|
||||
|
||||
DOTFILES_DIR="$HOME/Projects/config"
|
||||
|
||||
command_diff() {
|
||||
cd $DOTFILES_DIR
|
||||
git diff $@
|
||||
}
|
||||
|
||||
command_commit() {
|
||||
cd $DOTFILES_DIR
|
||||
git add .
|
||||
git commit -m $1
|
||||
}
|
||||
|
||||
command_status() {
|
||||
cd $DOTFILES_DIR
|
||||
git status
|
||||
}
|
||||
|
||||
command_add() {
|
||||
file=$1
|
||||
savepoint=$2
|
||||
mkdir -p "$DOTFILES_DIR/$(dirname "$savepoint")"
|
||||
mv "$file" "$DOTFILES_DIR/$savepoint"
|
||||
ln -s "$DOTFILES_DIR/$savepoint" "$file"
|
||||
cd $DOTFILES_DIR
|
||||
git add "$savepoint"
|
||||
|
||||
echo "$file added in $DOTFILES_DIR/$savepoint"
|
||||
}
|
||||
|
||||
command_echo() {
|
||||
echo Dotfiles echo: $@
|
||||
}
|
||||
|
||||
CMD=$1
|
||||
shift
|
||||
case "$CMD" in
|
||||
diff|commit|add|echo|status)
|
||||
command_$CMD $@
|
||||
;;
|
||||
*)
|
||||
echo "Command $CMD not found."
|
||||
;;
|
||||
esac
|
Loading…
Reference in a new issue