From: hayao Date: Thu, 18 Nov 2021 08:59:43 +0000 (+0900) Subject: [add] : 更新用スクリプトにLinux用GUIを追加 X-Git-Url: http://git.osdn.net/view?p=alterlinux%2Fhayao.fascode.net.git;a=commitdiff_plain;h=e41a4a1a393a5155de11c044c39a74a1b37c513c [add] : 更新用スクリプトにLinux用GUIを追加 --- diff --git a/blog/new-post-cli.sh b/blog/new-post-cli.sh new file mode 100755 index 0000000..0713532 --- /dev/null +++ b/blog/new-post-cli.sh @@ -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}" diff --git a/blog/new-post.desktop b/blog/new-post.desktop new file mode 100755 index 0000000..90c9253 --- /dev/null +++ b/blog/new-post.desktop @@ -0,0 +1,5 @@ +[Desktop Entry] +Type=Application +Version=1.0 +Name=Create new post +Exec=bash ./new-post.sh diff --git a/blog/new-post.sh b/blog/new-post.sh old mode 100755 new mode 100644 index 0713532..68823f1 --- a/blog/new-post.sh +++ b/blog/new-post.sh @@ -1,12 +1,5 @@ #!/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}" +set -Eeu +title="$(zenity --forms --add-entry="Title" --text="Set English short title for argument" | tr " " "-" | tr "[:upper:]" "[:lower:]")" +bash "$(cd "$(dirname "${0}")" && pwd)/new-post-cli.sh" "${title}" diff --git a/blog/new-post.vbs b/blog/new-post.vbs index acdaae2..6d9fd1c 100644 --- a/blog/new-post.vbs +++ b/blog/new-post.vbs @@ -4,4 +4,4 @@ Dim objShell Set objShell = CreateObject("WScript.Shell") Dim FlSysObj Set FlSysObj = createObject("Scripting.FileSystemObject") -objShell.Run "cmd /c " & "bash .\new-post.sh " & Input ,0,false +objShell.Run "cmd /c " & "bash .\new-post-cli.sh " & Input ,0,false