OSDN Git Service

[add] : 更新用スクリプトにLinux用GUIを追加
[alterlinux/hayao.fascode.net.git] / blog / new-post-cli.sh
diff --git a/blog/new-post-cli.sh b/blog/new-post-cli.sh
new file mode 100755 (executable)
index 0000000..0713532
--- /dev/null
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+
+set -eu
+
+script_path="$( cd -P "$( dirname "$(readlink -f "${0}")" )" && pwd )"
+
+[[ -z "${1-""}" ]] && echo "Set English short title for argument" >&2 && exit 1
+
+cd "${script_path}" || return 0
+filename="posts/$(date +%Y%m%d)/${1}/index.md"
+[[ ! -f "${script_path}/${filename}" ]] && hugo new "${filename}"
+type code 1>/dev/null 2>&1 && code "${script_path}/src/content/${filename}"