diff --git a/mcquack.py b/mcquack.py index dd7c48b..ef98e63 100755 --- a/mcquack.py +++ b/mcquack.py @@ -8,7 +8,6 @@ import os import plistlib import subprocess -import sys from pathlib import Path from typing import Annotated @@ -104,7 +103,10 @@ def create( plist_path = get_plist_path(script_path) if plist_path.exists(): - typer.echo(f"Error: {plist_path} already exists. Use 'edit' to modify or 'delete' first.", err=True) + typer.echo( + f"Error: {plist_path} already exists. Use 'edit' to modify or 'delete' first.", + err=True, + ) raise typer.Exit(1) # Ensure directories exist @@ -119,7 +121,9 @@ def create( typer.echo(f"Created: {plist_path}") # Load the plist - result = subprocess.run(["launchctl", "load", str(plist_path)], capture_output=True, text=True) + result = subprocess.run( + ["launchctl", "load", str(plist_path)], capture_output=True, text=True + ) if result.returncode != 0: typer.echo(f"Warning: launchctl load failed: {result.stderr}", err=True) raise typer.Exit(1) @@ -174,7 +178,9 @@ def show( typer.echo(f"Label: {plist.get('Label', 'unknown')}") typer.echo(f"Script: {program_args[0] if program_args else 'unknown'}") - typer.echo(f"Arguments: {' '.join(program_args[1:]) if len(program_args) > 1 else '(none)'}") + typer.echo( + f"Arguments: {' '.join(program_args[1:]) if len(program_args) > 1 else '(none)'}" + ) typer.echo(f"RunAtLoad: {plist.get('RunAtLoad', False)}") typer.echo(f"KeepAlive: {plist.get('KeepAlive', False)}") typer.echo(f"Stdout: {plist.get('StandardOutPath', 'N/A')}") @@ -225,7 +231,9 @@ def edit( typer.echo(f"Updated: {plist_path}") # Reload - result = subprocess.run(["launchctl", "load", str(plist_path)], capture_output=True, text=True) + result = subprocess.run( + ["launchctl", "load", str(plist_path)], capture_output=True, text=True + ) if result.returncode != 0: typer.echo(f"Warning: launchctl load failed: {result.stderr}", err=True) raise typer.Exit(1) @@ -245,7 +253,9 @@ def unload( typer.echo(f"Error: {plist_path} does not exist.", err=True) raise typer.Exit(1) - result = subprocess.run(["launchctl", "unload", str(plist_path)], capture_output=True, text=True) + result = subprocess.run( + ["launchctl", "unload", str(plist_path)], capture_output=True, text=True + ) if result.returncode != 0: typer.echo(f"Error: launchctl unload failed: {result.stderr}", err=True) raise typer.Exit(1) @@ -309,7 +319,7 @@ def quack() -> None: ;[[[}}}}[_, .";II" . .```:!!;^ - "If we're not back by dawn... call the press!" + "If it has wings, I can crash it." - Launchpad McQuack """ typer.echo(art)