Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

notify decorator won't fail on single quotes

  • Loading branch information...
knowsuchagency committed Aug 31, 2018
1 parent c0074b2 commit 83e5ef0e6c160d7d785508a147db18e8fa280743
Showing with 6 additions and 1 deletion.
  1. +1 −1 pyproject.toml
  2. +5 −0 shell_utils/notify.py
@@ -1,6 +1,6 @@
[tool.poetry]
name = "shell_utils"
version = "0.9.9"
version = "1.0.beta"
readme = 'readme.md'
repository = 'https://github.com/knowsuchagency/shell-utils'
description = "Shell automation tools, like Make on steroids."
@@ -23,6 +23,11 @@ def notify(message: str, title=None, subtitle=None, sound=None):
if sys.platform != 'darwin':
logging.warning('This function is designed to work on Mac OS')

# There is probably a less hacky way to escape single quotes safely
# but I haven't gotten to it

message = message.replace("'", '')

command = f"""osascript -e 'display notification "{message}" with title "{title}" subtitle "{subtitle}" sound name "{sound}"' """
sp.run(shlex.split(command), check=False)

0 comments on commit 83e5ef0

Please sign in to comment.
You can’t perform that action at this time.