OSDN Git Service

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