From 807de46d3a3cbef9a3c3c104f6db87b142e6eed5 Mon Sep 17 00:00:00 2001 From: filip <“filip.rabiega@gmail.com”> Date: Fri, 10 Oct 2025 19:10:02 +0200 Subject: used shfmt --- newnote | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'newnote') diff --git a/newnote b/newnote index c1b1835..ddf5c1b 100755 --- a/newnote +++ b/newnote @@ -2,16 +2,22 @@ dir="$HOME/.obsidian" -newnote () { - file="$dir/$1.md" - [ -f "$file" ] && { echo "Note with the same name already exists, exiting" >&2; exit 1 ;} - touch "$file" && "$EDITOR" +2 "$file" - if [ "$( wc -l "$file" | awk '{print $1}' )" -lt 2 ]; then - rm -f "$file" - fi +newnote() { + file="$dir/$1.md" + [ -f "$file" ] && { + echo "Note with the same name already exists, exiting" >&2 + exit 1 + } + touch "$file" && "$EDITOR" +2 "$file" + if [ "$(wc -l "$file" | awk '{print $1}')" -lt 2 ]; then + rm -f "$file" + fi } -[ "$#" -ne 1 ] && { echo "Usage: newnote " >&2; exit 1; } +[ "$#" -ne 1 ] && { + echo "Usage: newnote " >&2 + exit 1 +} newnote "$1" exit 0 -- cgit v1.2.3