|
|
@ -14,9 +14,6 @@ if [ "$(dirname "$0")" != "." ]; then |
|
|
|
exit |
|
|
|
exit |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
FILES="$(find . -type f \ |
|
|
|
|
|
|
|
| awk -v e="^($EXCLUDE_FILES)" 'substr($0, 3) !~ e { print $0 }')" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
help() { |
|
|
|
help() { |
|
|
|
B=$(tput bold) |
|
|
|
B=$(tput bold) |
|
|
|
U=$(tput smul) |
|
|
|
U=$(tput smul) |
|
|
@ -60,14 +57,21 @@ ${B}OPTIONS${N} |
|
|
|
EOF |
|
|
|
EOF |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
files() { |
|
|
|
set_files() { |
|
|
|
for f in $FILES; do |
|
|
|
FILES="$(find . -type f -o -type l \ |
|
|
|
echo "${f#??}" |
|
|
|
| awk -v e="^($EXCLUDE_FILES)" 'substr($0, 3) !~ e { print $0 }')" |
|
|
|
done |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
list_files() { |
|
|
|
|
|
|
|
# If unset |
|
|
|
|
|
|
|
[ -z "${FILES+x}" ] && set_files |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Remove ./ from beginning of filepaths |
|
|
|
|
|
|
|
echo "$FILES" | sed 's/^\.\///' |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
add() { |
|
|
|
add() { |
|
|
|
[ "$1" = "" ] && return 1 |
|
|
|
[ -z "$1" ] && return 1 |
|
|
|
|
|
|
|
|
|
|
|
FILE="$(readlink -f "$(dirname "$1")")/$(basename "$1")" |
|
|
|
FILE="$(readlink -f "$(dirname "$1")")/$(basename "$1")" |
|
|
|
FILE_CUT_HOME="$(echo "$FILE" \ |
|
|
|
FILE_CUT_HOME="$(echo "$FILE" \ |
|
|
@ -80,12 +84,16 @@ add() { |
|
|
|
# / |
|
|
|
# / |
|
|
|
else |
|
|
|
else |
|
|
|
mkdir -p "$(pwd)/$(dirname "$FILE")" |
|
|
|
mkdir -p "$(pwd)/$(dirname "$FILE")" |
|
|
|
cp -a "$FILE" "$(pwd)/$FILE" |
|
|
|
sudo cp -a "$FILE" "$(pwd)/$FILE" |
|
|
|
fi |
|
|
|
fi |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pull_push() { |
|
|
|
pull_push() { |
|
|
|
[ "$1" = "" ] && return 1 |
|
|
|
# If unset or empty string |
|
|
|
|
|
|
|
[ -z "$1" ] && return 1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# If unset |
|
|
|
|
|
|
|
[ -z "${FILES+x}" ] && set_files |
|
|
|
|
|
|
|
|
|
|
|
for f in $FILES; do |
|
|
|
for f in $FILES; do |
|
|
|
# Remove the first character (.) from the string |
|
|
|
# Remove the first character (.) from the string |
|
|
@ -185,7 +193,7 @@ case $OPT in |
|
|
|
add "$ARG" || option_wrong "$OPT" 'option requires an argument' |
|
|
|
add "$ARG" || option_wrong "$OPT" 'option requires an argument' |
|
|
|
;; |
|
|
|
;; |
|
|
|
-f | --files) |
|
|
|
-f | --files) |
|
|
|
files |
|
|
|
list_files |
|
|
|
;; |
|
|
|
;; |
|
|
|
-h | --help) |
|
|
|
-h | --help) |
|
|
|
help |
|
|
|
help |
|
|
|