-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathcli.py
More file actions
47 lines (43 loc) · 2.4 KB
/
cli.py
File metadata and controls
47 lines (43 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import argparse
import sys
from utils.config import get_preferred_model
from __init__ import __version__
def parse_args_only():
"""Parse command-line arguments without loading heavy libraries."""
from models.factory import ModelFactory
parser = argparse.ArgumentParser(description="ctrlSPEAK - Speech-to-text transcription tool")
parser.add_argument("--model", type=str,
default=get_preferred_model(),
help="Speech recognition model to use (default: %(default)s)")
parser.add_argument("--cohere", action="store_const", const="cohere", dest="model",
help="Shortcut for --model cohere (Apple Silicon MLX backend)")
parser.add_argument("--source-lang", type=str,
default="en",
help="Source language for transcription (default: %(default)s)")
parser.add_argument("--target-lang", type=str,
default="en",
help="Target language for translation (default: %(default)s)")
parser.add_argument("--debug", action="store_true",
help="Enable debug mode with verbose logging")
parser.add_argument("--check-only", action="store_true",
help="Check model cache and configuration, then exit.")
parser.add_argument("--list-models", action="store_true",
help="List all supported models and exit.")
parser.add_argument("-v", "--version", action="version",
version=f"%(prog)s {__version__}",
help="Show program's version number and exit.")
parser.add_argument("--file", type=str,
default=None,
help="Path to an audio file to transcribe (for testing).")
parser.add_argument("--check-compatibility", action="store_true",
help="Check compatibility of installed models and exit.")
parser.add_argument("--no-history", action="store_true",
help="Disable transcription history saving.")
parser.add_argument("--history-db", type=str,
default=None,
help="Custom path for history database (default: ~/.ctrlspeak/history.db)")
# Check if -h or --help is present
if '-h' in sys.argv or '--help' in sys.argv:
parser.print_help()
sys.exit(0)
return parser.parse_args()