2024-02-18 14:42:33
This commit is contained in:
parent
cf1210895c
commit
bb5c266dcd
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/bash -e
|
||||
#!/usr/bin/env -S bash -e
|
||||
#
|
||||
# Backup files with timestamp.
|
||||
#
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/bash -e
|
||||
#!/usr/bin/env -S bash -e
|
||||
#
|
||||
# Backup databases with timestamp.
|
||||
#
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/bash -e
|
||||
#!/usr/bin/env -S bash -e
|
||||
#
|
||||
# Generating a Debian package skeleton.
|
||||
#
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/bash -e
|
||||
#!/usr/bin/env -S bash -e
|
||||
#
|
||||
# Generating 'favicon' file.
|
||||
#
|
||||
|
|
2
git.sh
2
git.sh
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/bash -e
|
||||
#!/usr/bin/env -S bash -e
|
||||
#
|
||||
# Git functions for Bash.
|
||||
#
|
||||
|
|
90
hugo.sh
90
hugo.sh
|
@ -1,90 +0,0 @@
|
|||
#!/usr/bin/bash -e
|
||||
#
|
||||
# Hugo tools for Bash.
|
||||
#
|
||||
# @package Bash
|
||||
# @author Kai Kimera <mail@kai.kim>
|
||||
# @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
|
||||
}
|
||||
|
||||
"$@"
|
Loading…
Reference in New Issue