mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-02-02 19:48:15 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8143999f2a | |||
| 523bec769f | |||
| dee215a29e | |||
| 755ac0fa2c |
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -55,3 +55,6 @@
|
|||||||
[submodule "tmux/tmux-current-pane-hostname"]
|
[submodule "tmux/tmux-current-pane-hostname"]
|
||||||
path = config/tmux/plugins/tmux-current-pane-hostname
|
path = config/tmux/plugins/tmux-current-pane-hostname
|
||||||
url = https://github.com/soyuka/tmux-current-pane-hostname.git
|
url = https://github.com/soyuka/tmux-current-pane-hostname.git
|
||||||
|
[submodule "cheat-tldr"]
|
||||||
|
path = config/cheat/cheatsheets/tldr
|
||||||
|
url = https://github.com/ivuorinen/cheatsheet-tldr.git
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ git submodule add --name dotbot-pip \
|
|||||||
# other repos
|
# other repos
|
||||||
git submodule add --name cheat-community \
|
git submodule add --name cheat-community \
|
||||||
-f https://github.com/cheat/cheatsheets.git config/cheat/cheatsheets/community
|
-f https://github.com/cheat/cheatsheets.git config/cheat/cheatsheets/community
|
||||||
|
git submodule add --name cheat-tldr \
|
||||||
|
-f https://github.com/ivuorinen/cheatsheet-tldr.git config/cheat/cheatsheets/tldr
|
||||||
|
|
||||||
# tmux plugin manager and plugins
|
# tmux plugin manager and plugins
|
||||||
git submodule add --name tmux/tmux-continuum \
|
git submodule add --name tmux/tmux-continuum \
|
||||||
|
|||||||
@@ -75,6 +75,8 @@ alias code_scanner='docker run
|
|||||||
registry.gitlab.com/gitlab-org/ci-cd/codequality:"${CODEQUALITY_VERSION:-latest}"
|
registry.gitlab.com/gitlab-org/ci-cd/codequality:"${CODEQUALITY_VERSION:-latest}"
|
||||||
/code'
|
/code'
|
||||||
|
|
||||||
|
alias trivy_scan='docker run -v /var/run/docker.sock:/var/run/docker.sock -v $HOME/Library/Caches:/root/.cache/ aquasec/trivy'
|
||||||
|
|
||||||
alias zedit='$EDITOR ~/.dotfiles'
|
alias zedit='$EDITOR ~/.dotfiles'
|
||||||
|
|
||||||
alias irssi="irssi --config=$XDG_CONFIG_HOME/irssi/config --home=$XDG_CONFIG_HOME/irssi"
|
alias irssi="irssi --config=$XDG_CONFIG_HOME/irssi/config --home=$XDG_CONFIG_HOME/irssi"
|
||||||
|
|||||||
1
config/cheat/cheatsheets/tldr
Submodule
1
config/cheat/cheatsheets/tldr
Submodule
Submodule config/cheat/cheatsheets/tldr added at b0c7acbdc0
@@ -72,7 +72,7 @@ cheatpaths:
|
|||||||
tags: [pure-bash-bible]
|
tags: [pure-bash-bible]
|
||||||
readonly: true
|
readonly: true
|
||||||
- name: tldr
|
- name: tldr
|
||||||
path: ~/.dotfiles/config/cheat/cheatsheets/tldr
|
path: ~/.dotfiles/config/cheat/cheatsheets/tldr/tldr
|
||||||
tags: [tldr]
|
tags: [tldr]
|
||||||
readonly: true
|
readonly: true
|
||||||
# While it requires no configuration here, it's also worth noting that
|
# While it requires no configuration here, it's also worth noting that
|
||||||
|
|||||||
@@ -1,78 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
# shellcheck disable=SC2231,SC2034,SC2181,SC2068
|
|
||||||
# shellcheck source=shared.sh
|
|
||||||
source "$HOME/.dotfiles/scripts/shared.sh"
|
|
||||||
|
|
||||||
TLDR_REQUIRED_TOOLS=(git cheat)
|
|
||||||
for t in ${TLDR_REQUIRED_TOOLS[@]}; do
|
|
||||||
! x-have "$t" && echo "(!) $t is missing, can't continue..." && exit 1
|
|
||||||
done
|
|
||||||
|
|
||||||
TLDR_GIT="https://github.com/tldr-pages/tldr.git"
|
|
||||||
TLDR_SOURCE="source: $TLDR_GIT"
|
|
||||||
TLDR_SYNTAX="syntax: markdown"
|
|
||||||
|
|
||||||
TLDR_TEMP_PREFIX=$(basename "$0")
|
|
||||||
TLDR_TEMP_DIR="$XDG_CACHE_HOME/cheat/tldr"
|
|
||||||
|
|
||||||
# If there's no .git, clone the folder
|
|
||||||
if [ ! -d "$TLDR_TEMP_DIR/.git" ]; then
|
|
||||||
msg_run "Starting to clone $TLDR_GIT"
|
|
||||||
git clone --depth 1 --single-branch -q "$TLDR_GIT" "$TLDR_TEMP_DIR" \
|
|
||||||
&& msg_done "Cloned $TLDR_GIT"
|
|
||||||
else
|
|
||||||
# Update the repo
|
|
||||||
msg_run "Starting to update $TLDR_GIT"
|
|
||||||
git -C "$TLDR_TEMP_DIR" reset --hard origin/main
|
|
||||||
git -C "$TLDR_TEMP_DIR" pull -q --depth 2 \
|
|
||||||
&& msg_done "Updated $TLDR_GIT"
|
|
||||||
fi
|
|
||||||
|
|
||||||
msg_run "Removing non-english translation files"
|
|
||||||
rm -rf "$TLDR_TEMP_DIR/pages.*"
|
|
||||||
|
|
||||||
# Fetch the destination directory from cheat defined directories.
|
|
||||||
TLDR_CHEAT_DEST="$(cheat -d | grep tldr | head -1 | awk '{print $2}')"
|
|
||||||
|
|
||||||
[ "$TLDR_CHEAT_DEST" = "" ] \
|
|
||||||
&& msg_err "cheat doesn't know about the destination" \
|
|
||||||
&& exit 1
|
|
||||||
|
|
||||||
if [ ! -d "$TLDR_CHEAT_DEST" ]; then
|
|
||||||
mkdir -p "$TLDR_CHEAT_DEST"
|
|
||||||
fi
|
|
||||||
|
|
||||||
for d in "$TLDR_TEMP_DIR"/pages/*; do
|
|
||||||
DIRNAME=$(basename "$d")
|
|
||||||
# echo "-> $DIRNAME ($d)"
|
|
||||||
|
|
||||||
SECTION_DIR="${TLDR_CHEAT_DEST}/$DIRNAME"
|
|
||||||
|
|
||||||
[ "$DIRNAME" = "common" ] && SECTION_DIR="${TLDR_CHEAT_DEST}"
|
|
||||||
|
|
||||||
TLDR_TAGS="tags: [$DIRNAME]"
|
|
||||||
|
|
||||||
if [ ! -d "$SECTION_DIR" ]; then
|
|
||||||
mkdir -p "$SECTION_DIR"
|
|
||||||
fi
|
|
||||||
|
|
||||||
for FILE in $d/*.md; do
|
|
||||||
BASENAME=$(basename "$FILE" .md)
|
|
||||||
FILENAME="${BASENAME%%.*}"
|
|
||||||
# echo "-> $FILE = $FILENAME"
|
|
||||||
TLDR_FILE="$SECTION_DIR/${BASENAME}"
|
|
||||||
# echo "-> dest: $TLDR_FILE"
|
|
||||||
|
|
||||||
# Update the original file for making the replacable value comparable
|
|
||||||
if [ -f "$FILE" ] && [ '---' != "$(head -1 < "$FILE")" ]; then
|
|
||||||
echo -e "---\n$TLDR_SYNTAX\n$TLDR_TAGS\n$TLDR_SOURCE\n---\n$(cat "$FILE")" > "$FILE"
|
|
||||||
fi
|
|
||||||
|
|
||||||
replacable "$FILE" "$TLDR_FILE"
|
|
||||||
override=$?
|
|
||||||
if [ "$override" -ne 0 ]; then
|
|
||||||
cp "$FILE" "$TLDR_FILE" && msg_run "Updated: $TLDR_FILE"
|
|
||||||
fi
|
|
||||||
|
|
||||||
done
|
|
||||||
done
|
|
||||||
Reference in New Issue
Block a user