From bb5c266dcd29f62b4ecbda407c9a17176487d1c1 Mon Sep 17 00:00:00 2001 From: KaiKimera Date: Sun, 18 Feb 2024 17:42:33 +0300 Subject: [PATCH] 2024-02-18 14:42:33 --- backup.files.sh | 2 +- backup.mysql.sh | 2 +- debian.build.sh | 2 +- favicon.sh | 2 +- git.sh | 2 +- hugo.sh | 90 ------------------------------------------------- 6 files changed, 5 insertions(+), 95 deletions(-) delete mode 100644 hugo.sh diff --git a/backup.files.sh b/backup.files.sh index cd0dc1d..739cda8 100644 --- a/backup.files.sh +++ b/backup.files.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash -e +#!/usr/bin/env -S bash -e # # Backup files with timestamp. # diff --git a/backup.mysql.sh b/backup.mysql.sh index a01278a..7f8e5a3 100644 --- a/backup.mysql.sh +++ b/backup.mysql.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash -e +#!/usr/bin/env -S bash -e # # Backup databases with timestamp. # diff --git a/debian.build.sh b/debian.build.sh index 5b458b0..b2d0b08 100644 --- a/debian.build.sh +++ b/debian.build.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash -e +#!/usr/bin/env -S bash -e # # Generating a Debian package skeleton. # diff --git a/favicon.sh b/favicon.sh index 88478a1..0747903 100644 --- a/favicon.sh +++ b/favicon.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash -e +#!/usr/bin/env -S bash -e # # Generating 'favicon' file. # diff --git a/git.sh b/git.sh index 8ff2b21..b4cd5ce 100644 --- a/git.sh +++ b/git.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash -e +#!/usr/bin/env -S bash -e # # Git functions for Bash. # diff --git a/hugo.sh b/hugo.sh deleted file mode 100644 index 964a212..0000000 --- a/hugo.sh +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/bash -e -# -# Hugo tools for Bash. -# -# @package Bash -# @author Kai Kimera -# @copyright 2023 iHub TO -# @license MIT -# @version 0.0.1 -# @link https://lib.onl -# -------------------------------------------------------------------------------------------------------------------- # - -(( EUID == 0 )) && { echo >&2 'This script should not be run as root!'; exit 1; } - -_cmd_screen() { - command -v screen -} - -_cmd_hugo() { - command -v hugo -} - -_year() { - date -u '+%Y' -} - -_month() { - date -u '+%m' -} - -_timestamp() { - date -u '+%s%N' | cut -b1-13 -} - -_hugo() { - cache="$( pwd )" - echo "$( _cmd_hugo )" --i18n-warnings --cacheDir "${cache}/cache" --gc -} - -run() { - eval "$( _hugo "$@" )" -} - -server() { - local OPTIND=1 - - while getopts 'p:h' opt; do - case ${opt} in - p) - local port="${OPTARG}"; - ;; - h|*) - echo "-p '1313'"; exit 2 - ;; - esac - done - - shift $(( OPTIND - 1 )) - - eval "$( _hugo "$@" ) server -D -p ${port}" -} - -watch() { - eval "$( _hugo "$@" ) -w" -} - -new() { - local OPTIND=1 - - while getopts 't:h' opt; do - case ${opt} in - t) - local type="${OPTARG}"; - ;; - h|*) - echo "-t ['posts' | '...']"; exit 2 - ;; - esac - done - - shift $(( OPTIND - 1 )) - - if [[ ${type} == 'posts' ]]; then - $( _cmd_hugo ) new "${type}/$( _year )/$( _month )/$( _timestamp )" - else - $( _cmd_hugo ) new "${type}/$( _timestamp )" - fi -} - -"$@"