audio-sink.sh 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #!/usr/bin/env bash
  2. # Thin wrapper around the Python CLI for audio sink management.
  3. # Delegates to uv run stt-daemon.
  4. set -euo pipefail
  5. # Resolve the repo root from the script location
  6. SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  7. REPO_ROOT="$(dirname "$SCRIPT_DIR")"
  8. help() {
  9. cat << 'EOF'
  10. STT Daemon Audio Sink Manager (wrapper)
  11. Usage: scripts/audio-sink.sh [start|stop|status|help]
  12. Commands:
  13. start - Create virtual microphone (delegated to `uv run stt-daemon setup`)
  14. stop - Remove virtual microphone (delegated to `uv run stt-daemon clear --yes`)
  15. status - Show sink status (delegated to `uv run stt-daemon list`)
  16. help - Show this message
  17. Note: This is a thin wrapper. Use `uv run stt-daemon --help` for full CLI options.
  18. Example:
  19. scripts/audio-sink.sh start
  20. scripts/audio-sink.sh status
  21. scripts/audio-sink.sh stop
  22. EOF
  23. }
  24. main() {
  25. local cmd="${1:-help}"
  26. case "$cmd" in
  27. start)
  28. cd "$REPO_ROOT"
  29. uv run stt-daemon setup
  30. ;;
  31. stop)
  32. cd "$REPO_ROOT"
  33. uv run stt-daemon clear --yes
  34. ;;
  35. status)
  36. cd "$REPO_ROOT"
  37. uv run stt-daemon list
  38. ;;
  39. help|--help|-h)
  40. help
  41. ;;
  42. *)
  43. echo "Unknown command: $cmd" >&2
  44. echo "Use 'scripts/audio-sink.sh help' for usage" >&2
  45. return 1
  46. ;;
  47. esac
  48. }
  49. main "$@"