julienXX / terminal-notifier

Send User Notifications on macOS from the command-line.
Other
6.36k stars 331 forks source link

Titles starting with hyphens do not work #263

Closed forthrin closed 5 years ago

forthrin commented 5 years ago

Example:

$ terminal-notifier -title -123 -message 456
WidgetsBurritos commented 5 years ago

This seems to work: terminal-notifier -title "\-123" -message 456

This escapes the hyphen so it's treated as part of the string

forthrin commented 1 year ago

Several other ASCII characters must also be escaped. (Remove four or the backslahes for comparison.)

$ for f in 34 40 42 45 60 91 92 123; do terminal-notifier -title $(printf "\\\\\x$(printf %x $f)") -message $f; done

@julienXX: Shouldn't the application escape these automatically? It's not the shell's responsibility, really.

Other observations regarding string arguments:

  1. Spaces and Tabs are left-trimmed, and displayed like expected when inside the string.
  2. Everything following a Tab is not displayed
  3. Everything following CR or LF only displays "..."
  4. Other Control Characters than the above, plus DEL, are ignored anywhere.
  5. Unicode characters seem to be working out of the box.