Move pages under tldr, lint run.sh, update docs

This commit is contained in:
2024-02-21 13:58:43 +02:00
parent 3d653cc7e6
commit 2c475fa62d
4806 changed files with 36 additions and 35 deletions

10
.github/README.md vendored
View File

@@ -15,10 +15,10 @@ git clone https://github.com/ivuorinen/cheatsheet-tldr.git ~/.cheat/cheatsheets/
Configure your `cheat.yaml` to include the cheatsheets:
```yaml
- name: tldr
path: ~/.cheat/cheatsheets/tldr
tags: [tldr]
readonly: true
- name: tldr
path: ~/.cheat/cheatsheets/tldr/tldr
tags: [tldr]
readonly: true
```
## Usage
@@ -33,4 +33,4 @@ cheat --tags tldr
## License
Files under `.github/` are licensed under the [MIT License](LICENSE.md).
TLDR pages licensed under [CC-BY-4.0](https://github.com/tldr-pages/tldr/blob/main/LICENSE.md).
TLDR pages under `tldr/` licensed under [CC-BY-4.0](https://github.com/tldr-pages/tldr/blob/main/LICENSE.md).

60
.github/run.sh vendored
View File

@@ -6,7 +6,7 @@
# TLDR pages licensed under CC-BY-4.0
# https://github.com/tldr-pages/tldr/blob/main/LICENSE.md
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
echo "Running: $DIR/run.sh"
echo "Working directory: $DIR"
@@ -17,56 +17,56 @@ TLDR_GIT="https://github.com/tldr-pages/tldr.git"
TLDR_SOURCE="source: $TLDR_GIT"
TLDR_SYNTAX="syntax: markdown"
TLDR_TEMP_DIR="$(realpath "$DIR"/..)/__tldr-temp"
TLDR_CHEAT_DEST="$(realpath "$DIR"/../)"
TLDR_CHEAT_DEST="$(realpath "$DIR"/../tldr)"
if [ -d "$TLDR_TEMP_DIR" ]; then
rm -rf "$TLDR_TEMP_DIR"
rm -rf "$TLDR_TEMP_DIR"
fi
echo "TLDR_TEMP_DIR: $TLDR_TEMP_DIR"
echo "TLDR_CHEAT_DEST: $TLDR_CHEAT_DEST"
git clone \
--depth 1 \
--single-branch \
-q "$TLDR_GIT" "$TLDR_TEMP_DIR" || exit 1
--depth 1 \
--single-branch \
-q "$TLDR_GIT" "$TLDR_TEMP_DIR" || exit 1
rm -rf "$TLDR_TEMP_DIR/pages.*"
for d in "$TLDR_TEMP_DIR"/pages/*; do
DIRNAME=$(basename "$d")
# echo "-> $DIRNAME ($d)"
DIRNAME=$(basename "$d")
# echo "-> $DIRNAME ($d)"
SECTION_DIR="${TLDR_CHEAT_DEST}/$DIRNAME"
SECTION_DIR="${TLDR_CHEAT_DEST}/$DIRNAME"
[ "$DIRNAME" = "common" ] && SECTION_DIR="${TLDR_CHEAT_DEST}"
[ "$DIRNAME" = "common" ] && SECTION_DIR="${TLDR_CHEAT_DEST}"
TLDR_TAGS="tags: [tldr, $DIRNAME]"
TLDR_TAGS="tags: [tldr, $DIRNAME]"
if [ ! -d "$SECTION_DIR" ]; then
mkdir -p "$SECTION_DIR"
fi
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"
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 replaceable 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
# Update the original file for making the replaceable 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
replaceable "$FILE" "$TLDR_FILE"
replaceable "$FILE" "$TLDR_FILE"
override=$?
if [ "$override" -ne 0 ]; then
cp "$FILE" "$TLDR_FILE" && echo "Updated: $TLDR_FILE"
fi
override=$?
if [ "$override" -ne 0 ]; then
cp "$FILE" "$TLDR_FILE" && echo "Updated: $TLDR_FILE"
fi
done
done
done
rm -rf "$TLDR_TEMP_DIR"

1
.gitignore vendored
View File

@@ -1 +1,2 @@
__tldr-temp
!*-secret

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

Some files were not shown because too many files have changed in this diff Show More