From b63c7613d0f2619a03f667ae7ff719306462ad23 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Fri, 10 May 2013 01:55:45 +0200 Subject: .functions: Improve `note` Give the Notes.app function the ability to add both `title` and `body`. Closes #203. --- .functions | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to '.functions') diff --git a/.functions b/.functions index ca55c46..5a2788b 100644 --- a/.functions +++ b/.functions @@ -195,20 +195,22 @@ function getcertnames() { } # Add note to Notes.app (OS X 10.8) -# Usage: `note 'foo'` or `echo 'foo' | note` +# Usage: `note 'title' 'body'` or `echo 'body' | note` +# Title is optional function note() { - local text - if [ -t 0 ]; then # argument - text="$1" - else # pipe - text=$(cat) + local title + local body + if [ -t 0 ]; then + title="$1" + body="$2" + else + title=$(cat) fi - body=$(echo "$text" | sed -E 's|$|
|g') osascript >/dev/null <
" & "$body"} end tell end tell end tell -- cgit v1.2.3