File tree Expand file tree Collapse file tree 2 files changed +19
-4
lines changed
Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -76,8 +76,9 @@ while getopts ":v:m:r:yh" opt; do
7676done
7777
7878if [[ -z " $VERSION " ]]; then
79- VERSION=" $( date +%Y-%m-%d) "
80- echo " Ingen version angiven. Använder dagens datum som version: $VERSION "
79+ echo " Fel: -v <version> krävs."
80+ usage
81+ exit 1
8182fi
8283
8384TAG=" lab_${VERSION} "
@@ -103,7 +104,14 @@ if [[ -z "$MESSAGE" ]]; then
103104 echo " (Skriv ditt meddelande ovan. Ta inte bort sista raden.)"
104105 echo " ---"
105106 } > " $tmpfile "
106- " ${GIT_EDITOR:- ${VISUAL:- vi} } " " $tmpfile "
107+
108+ editor_cmd=" $( git config --get core.editor || true) "
109+ if [[ -z " $editor_cmd " ]]; then
110+ echo " core.editor är inte satt. Ex: git config --global core.editor 'nano -w'" >&2
111+ exit 1
112+ fi
113+ sh -c " $editor_cmd \"\$ 1\" " _ " $tmpfile "
114+
107115 MESSAGE=" $( sed ' /^---$/,$d' " $tmpfile " | sed -e ' ${/^$/d}' ) "
108116 rm -f " $tmpfile "
109117 [[ -z " $MESSAGE " ]] && MESSAGE=" Lab instructions $VERSION "
Original file line number Diff line number Diff line change @@ -133,7 +133,14 @@ if [[ -z "$MESSAGE" ]]; then
133133 echo " (Skriv ditt meddelande ovan. Ta inte bort sista raden.)"
134134 echo " ---"
135135 } > " $tmpfile "
136- " ${GIT_EDITOR:- ${VISUAL:- vi} } " " $tmpfile "
136+
137+ editor_cmd=" $( git config --get core.editor || true) "
138+ if [[ -z " $editor_cmd " ]]; then
139+ echo " core.editor är inte satt. Ex: git config --global core.editor 'nano -w'" >&2
140+ exit 1
141+ fi
142+ sh -c " $editor_cmd \"\$ 1\" " _ " $tmpfile "
143+
137144 MESSAGE=" $( sed ' /^---$/,$d' " $tmpfile " | sed -e ' ${/^$/d}' ) "
138145 rm -f " $tmpfile "
139146
You can’t perform that action at this time.
0 commit comments