82 lines
1.6 KiB
Markdown
82 lines
1.6 KiB
Markdown
|
|
# Tooling
|
|
|
|
A collection of useful command-line tools.
|
|
|
|
## OCR Screenshot Tool
|
|
|
|
A CLI tool that takes region screenshots on macOS, performs OCR using Tesseract, and copies the result to clipboard.
|
|
|
|
### Prerequisites
|
|
|
|
- macOS (uses built-in `screencapture` command)
|
|
- Tesseract OCR (install with `brew install tesseract`)
|
|
|
|
### Usage
|
|
|
|
Basic usage (takes screenshot, performs OCR, copies to clipboard):
|
|
```bash
|
|
uv run ocr-screenshot
|
|
```
|
|
|
|
With verbose output:
|
|
```bash
|
|
uv run ocr-screenshot --verbose
|
|
```
|
|
|
|
Save the screenshot image:
|
|
```bash
|
|
uv run ocr-screenshot --save-image
|
|
```
|
|
|
|
Specify OCR language (e.g., for Chinese):
|
|
```bash
|
|
uv run ocr-screenshot --lang chi_sim
|
|
```
|
|
|
|
### How it works
|
|
|
|
1. **Screenshot**: Click and drag to select a region, or press Space to capture an entire window
|
|
2. **OCR**: The selected region is processed with Tesseract OCR
|
|
3. **Clipboard**: The extracted text is automatically copied to your clipboard
|
|
|
|
## Development Guide
|
|
|
|
### How to Add New Packages
|
|
|
|
To add a new production dependency (e.g., 'requests'):
|
|
```bash
|
|
uv add requests
|
|
```
|
|
|
|
To add a new development dependency (e.g., 'ipdb'):
|
|
```bash
|
|
uv add --dev ipdb
|
|
```
|
|
|
|
After adding dependencies, always re-generate requirements.txt:
|
|
```bash
|
|
uv pip compile pyproject.toml -o requirements.txt
|
|
```
|
|
|
|
### How to Build Packages
|
|
|
|
To build your project's distributable packages (.whl, .tar.gz):
|
|
```bash
|
|
python -m build
|
|
```
|
|
|
|
Or using the virtual environment directly:
|
|
```bash
|
|
./venv/bin/python -m build
|
|
```
|
|
|
|
### Offline Build
|
|
|
|
To build offline packages for deployment:
|
|
```bash
|
|
./dev_scripts/build_offline.sh
|
|
```
|
|
|
|
This will create offline_packages/ with all dependencies and install.sh
|