mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-01-26 11:14:08 +00:00
feat(dfm): Install cheat databases with dfm
This commit is contained in:
@@ -18,7 +18,9 @@ PBB_TEMP_DIR="/tmp/pbb-$(rnd)"
|
||||
|
||||
# If there's no .git, clone the folder
|
||||
if [ ! -d "$PBB_TEMP_DIR/.git" ]; then
|
||||
git clone "$PBB_GIT" "$PBB_TEMP_DIR"
|
||||
msg_run "Starting to clone $PBB_GIT"
|
||||
git clone --depth 1 --single-branch -q "$PBB_GIT" "$PBB_TEMP_DIR" \
|
||||
&& msg_yay "Cloned $PBB_GIT"
|
||||
fi
|
||||
|
||||
PBB_CHAPTERS=$(ls -1v "$PBB_TEMP_DIR"/manuscript/chapter*)
|
||||
@@ -32,10 +34,9 @@ for f in ${PBB_CHAPTERS[@]}; do
|
||||
# get all headers, take the first one, strip the # and return the first word in lowercase
|
||||
HEADER=$(grep -e '^[#] ' "$f" | head -1 | awk '{print tolower($2)}')
|
||||
CHEAT_FILE="$CHEAT_DEST/${HEADER}"
|
||||
echo "(*) $CHEAT_FILE"
|
||||
|
||||
if [ ! -f "$CHEAT_FILE" ]; then
|
||||
cp "$f" "$CHEAT_FILE"
|
||||
cp "$f" "$CHEAT_FILE" && msg_run "$CHEAT_FILE"
|
||||
fi
|
||||
|
||||
LC_ALL=C perl -pi.bak -e 's/\<\!-- CHAPTER END --\>//' "$CHEAT_FILE"
|
||||
|
||||
@@ -17,7 +17,9 @@ TLDR_TEMP_DIR="/tmp/cheat-tldr-$(rnd)"
|
||||
|
||||
# If there's no .git, clone the folder
|
||||
if [ ! -d "$TLDR_TEMP_DIR/.git" ]; then
|
||||
git clone --depth 1 "$TLDR_GIT" "$TLDR_TEMP_DIR"
|
||||
msg_run "Starting to clone $TLDR_GIT"
|
||||
git clone --depth 1 --single-branch -q "$TLDR_GIT" "$TLDR_TEMP_DIR" \
|
||||
&& msg_done "Cloned $TLDR_GIT"
|
||||
fi
|
||||
|
||||
# Fetch the destination directory from cheat defined directories.
|
||||
@@ -50,7 +52,7 @@ for d in "$TLDR_TEMP_DIR"/pages/*; do
|
||||
# echo "-> dest: $TLDR_FILE"
|
||||
|
||||
if [ ! -f "$TLDR_FILE" ]; then
|
||||
cp "$FILE" "$TLDR_FILE"
|
||||
cp "$FILE" "$TLDR_FILE" && msg_run "$TLDR_FILE"
|
||||
fi
|
||||
|
||||
if [ -f "$TLDR_FILE" ] && [ '---' != "$(head -1 < "$TLDR_FILE")" ]; then
|
||||
|
||||
Reference in New Issue
Block a user