OSDN Git Service

[add] : 更新用スクリプトにLinux用GUIを追加
authorhayao <hayao@fascode.net>
Thu, 18 Nov 2021 08:59:43 +0000 (17:59 +0900)
committerhayao <hayao@fascode.net>
Thu, 18 Nov 2021 08:59:43 +0000 (17:59 +0900)
blog/new-post-cli.sh [new file with mode: 0755]
blog/new-post.desktop [new file with mode: 0755]
blog/new-post.sh [changed mode: 0755->0644]
blog/new-post.vbs

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}"
diff --git a/blog/new-post.desktop b/blog/new-post.desktop
new file mode 100755 (executable)
index 0000000..90c9253
--- /dev/null
@@ -0,0 +1,5 @@
+[Desktop Entry]
+Type=Application
+Version=1.0
+Name=Create new post
+Exec=bash ./new-post.sh
old mode 100755 (executable)
new mode 100644 (file)
index 0713532..68823f1
@@ -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}"
index acdaae2..6d9fd1c 100644 (file)
@@ -4,4 +4,4 @@ Dim objShell
 Set objShell = CreateObject("WScript.Shell")\r
 Dim FlSysObj\r
 Set FlSysObj = createObject("Scripting.FileSystemObject")\r
-objShell.Run "cmd /c " & "bash .\new-post.sh " & Input ,0,false\r
+objShell.Run "cmd /c " & "bash .\new-post-cli.sh " & Input ,0,false\r