This commit is contained in:
2026-07-10 15:11:51 +08:00
parent 8bfcf23bc2
commit da17239d7d
148 changed files with 2542 additions and 4873 deletions
+40 -31
View File
@@ -1,24 +1,31 @@
#!/usr/bin/env bash
##makedesc: Install file templates (KDE)
echo
echo "==============================================="
echo "Installing file templates (KDE)..."
echo "==============================================="
echo
set -eo pipefail
TPL_DIR="$HOME/.local/share/templates"
TPL_SRC="$TPL_DIR/.source"
[ ! -d "$TPL_SRC" ] && mkdir -p "$TPL_SRC"
if [ "$(uname -s)" = "Darwin" ]; then
echo "WARNING: KDE file templates are not applicable on macOS." >&2
exit 1
fi
echo "- Markdown" ####################################################
cat <<EOF > "$TPL_SRC/template.md"
install() {
echo "==============================================="
echo "Installing file templates (KDE)..."
echo "==============================================="
echo
TPL_DIR="$HOME/.local/share/templates"
TPL_SRC="$TPL_DIR/.source"
[ ! -d "$TPL_SRC" ] && mkdir -p "$TPL_SRC"
echo "- Markdown" ####################################################
cat <<EOF > "$TPL_SRC/template.md"
# Title
EOF
cat << EOF > "$TPL_DIR/md.desktop"
cat << EOF > "$TPL_DIR/md.desktop"
[Desktop Entry]
Name=Документ Markdown
Icon=text-markdown
@@ -26,8 +33,8 @@ Type=Link
URL=.source/template.md
EOF
echo "- PHP" ####################################################
cat <<EOF > "$TPL_SRC/template.php"
echo "- PHP" ####################################################
cat <<EOF > "$TPL_SRC/template.php"
<?php
declare(strict_types=1);
ini_set('error_reporting', E_ALL);
@@ -38,7 +45,7 @@ ini_set('log_errors', 1);
EOF
cat << EOF > "$TPL_DIR/php.desktop"
cat << EOF > "$TPL_DIR/php.desktop"
[Desktop Entry]
Name=PHP-скрипт
Icon=application-x-php
@@ -46,8 +53,8 @@ Type=Link
URL=.source/template.php
EOF
echo "- Shell" ####################################################
cat <<EOF > "$TPL_SRC/template.sh"
echo "- Shell" ####################################################
cat <<EOF > "$TPL_SRC/template.sh"
#!/usr/bin/env bash
EOF
@@ -59,8 +66,8 @@ Type=Link
URL=.source/template.sh
EOF
echo "- Go" ####################################################
cat <<EOF > "$TPL_SRC/template.go"
echo "- Go" ####################################################
cat <<EOF > "$TPL_SRC/template.go"
package main
import "fmt"
@@ -70,14 +77,14 @@ func main() {
}
EOF
cat << EOF > "$TPL_DIR/go.desktop"
cat << EOF > "$TPL_DIR/go.desktop"
[Desktop Entry]
Name=Golang файл
Type=Link
URL=.source/template.go
EOF
echo "- Dockerfile" ####################################################
echo "- Dockerfile" ####################################################
cat <<EOF > "$TPL_SRC/Dockerfile"
# https://habr.com/ru/company/ruvds/blog/439980/
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/
@@ -86,33 +93,35 @@ FROM ubuntu:latest
EOF
cat << EOF > "$TPL_DIR/dockerfile.desktop"
cat << EOF > "$TPL_DIR/dockerfile.desktop"
[Desktop Entry]
Name=Dockerfile
Type=Link
URL=.source/Dockerfile.go
EOF
echo "- docker-compose" ####################################################
cat <<EOF > "$TPL_SRC/docker-compose.yml"
echo "- docker-compose" ####################################################
cat <<EOF > "$TPL_SRC/docker-compose.yml"
# https://docs.docker.com/compose/gettingstarted/
# https://docs.docker.com/compose/compose-file/compose-file-v3/
version: "3.9"
services:
EOF
cat << EOF > "$TPL_DIR/docker-compose.desktop"
cat << EOF > "$TPL_DIR/docker-compose.desktop"
[Desktop Entry]
Name=docker-compose
Type=Link
URL=.source/docker-compose.yml
EOF
echo
echo "Finish! You can find them here:"
echo -e "\t$TPL_DIR"
echo
echo
echo "Finish! You can find them here:"
echo -e "\t$TPL_DIR"
echo
}
case "$1" in
*) install ;;
esac