mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 18:25:00 +00:00
refactor: Extract notification message into a constant
This commit is contained in:
parent
95e1fe0446
commit
448de8519a
1 changed files with 8 additions and 5 deletions
13
aider/io.py
13
aider/io.py
|
@ -12,6 +12,9 @@ from datetime import datetime
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
# Constants
|
||||||
|
NOTIFICATION_MESSAGE = "Aider is waiting for your input"
|
||||||
|
|
||||||
from prompt_toolkit.completion import Completer, Completion, ThreadedCompleter
|
from prompt_toolkit.completion import Completer, Completion, ThreadedCompleter
|
||||||
from prompt_toolkit.cursor_shapes import ModalCursorShapeConfig
|
from prompt_toolkit.cursor_shapes import ModalCursorShapeConfig
|
||||||
from prompt_toolkit.enums import EditingMode
|
from prompt_toolkit.enums import EditingMode
|
||||||
|
@ -969,10 +972,10 @@ class InputOutput:
|
||||||
if system == "Darwin": # macOS
|
if system == "Darwin": # macOS
|
||||||
# Check for terminal-notifier first
|
# Check for terminal-notifier first
|
||||||
if shutil.which("terminal-notifier"):
|
if shutil.which("terminal-notifier"):
|
||||||
return "terminal-notifier -title 'Aider' -message 'Aider is waiting for your input'"
|
return f"terminal-notifier -title 'Aider' -message '{NOTIFICATION_MESSAGE}'"
|
||||||
# Fall back to osascript
|
# Fall back to osascript
|
||||||
return (
|
return (
|
||||||
'osascript -e \'display notification "Aider is waiting for your input" with title'
|
f'osascript -e \'display notification "{NOTIFICATION_MESSAGE}" with title'
|
||||||
' "Aider"\''
|
' "Aider"\''
|
||||||
)
|
)
|
||||||
elif system == "Linux":
|
elif system == "Linux":
|
||||||
|
@ -980,16 +983,16 @@ class InputOutput:
|
||||||
for cmd in ["notify-send", "zenity"]:
|
for cmd in ["notify-send", "zenity"]:
|
||||||
if shutil.which(cmd):
|
if shutil.which(cmd):
|
||||||
if cmd == "notify-send":
|
if cmd == "notify-send":
|
||||||
return "notify-send 'Aider' 'Aider is waiting for your input'"
|
return f"notify-send 'Aider' '{NOTIFICATION_MESSAGE}'"
|
||||||
elif cmd == "zenity":
|
elif cmd == "zenity":
|
||||||
return "zenity --notification --text='Aider is waiting for your input'"
|
return f"zenity --notification --text='{NOTIFICATION_MESSAGE}'"
|
||||||
return None # No known notification tool found
|
return None # No known notification tool found
|
||||||
elif system == "Windows":
|
elif system == "Windows":
|
||||||
# PowerShell notification
|
# PowerShell notification
|
||||||
return (
|
return (
|
||||||
"powershell -command"
|
"powershell -command"
|
||||||
" \"[System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms');"
|
" \"[System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms');"
|
||||||
" [System.Windows.Forms.MessageBox]::Show('Aider is waiting for your input',"
|
f" [System.Windows.Forms.MessageBox]::Show('{NOTIFICATION_MESSAGE}',"
|
||||||
" 'Aider')\""
|
" 'Aider')\""
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue