diff options
Diffstat (limited to '.functions')
-rw-r--r-- | .functions | 18 |
1 files changed, 10 insertions, 8 deletions
@@ -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|$|<br>|g') osascript >/dev/null <<EOF tell application "Notes" tell account "iCloud" tell folder "Notes" - make new note with properties {name:"$text", body:"$body"} + make new note with properties {name:"$title", body:"$title" & "<br><br>" & "$body"} end tell end tell end tell |