diff options
author | Sindre Sorhus <sindresorhus@gmail.com> | 2013-05-10 01:55:45 +0200 |
---|---|---|
committer | Mathias Bynens <mathias@qiwi.be> | 2013-05-10 08:33:58 +0200 |
commit | b63c7613d0f2619a03f667ae7ff719306462ad23 (patch) | |
tree | e7f7cc5cfe2e221984a4e4f87a2025b8e0685662 /.functions | |
parent | 5a44681edcac0b137ddaa6523af8d7fa6747550d (diff) | |
download | dotfiles-b63c7613d0f2619a03f667ae7ff719306462ad23.tar.gz dotfiles-b63c7613d0f2619a03f667ae7ff719306462ad23.tar.bz2 dotfiles-b63c7613d0f2619a03f667ae7ff719306462ad23.zip |
.functions: Improve `note`
Give the Notes.app function the ability to add both `title` and `body`.
Closes #203.
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 |