Support multiple repositories per execution
- Add RepoConfig type for per-repo path/remote/branch - Options now holds [RepoConfig] instead of single repo - YAML config file support (--config) for multi-repo setup - --repo still works for quick single-repo usage - Concurrent watchers via async (one thread per repo) - --debounce flag overrides config file value
This commit is contained in:
@@ -1,30 +1,54 @@
|
||||
# Converge
|
||||
|
||||
Auto-sync a git repository by watching for file changes, automatically committing them, and pulling from a remote.
|
||||
Auto-sync one or more git repositories by watching for file changes, automatically committing them, and pulling from a remote.
|
||||
|
||||
Converge notifies the user via libnotify / `notify-send` whenever a merge conflict occurs during automatic pulling.
|
||||
|
||||
## Usage
|
||||
|
||||
### Single repository
|
||||
|
||||
```bash
|
||||
# Watch the current directory (defaults)
|
||||
./scripts/run
|
||||
|
||||
# Watch a specific repo
|
||||
./scripts/run -- --repo /path/to/repo --branch master
|
||||
./scripts/run -- --repo /path/to/repo --branch master --debounce 10000
|
||||
```
|
||||
|
||||
# Custom debounce (10 seconds)
|
||||
./scripts/run -- --debounce 10000
|
||||
### Multiple repositories (config file)
|
||||
|
||||
```bash
|
||||
# Create a config file
|
||||
cp converge.example.yaml converge.yaml
|
||||
# Edit to list your repos
|
||||
vim converge.yaml
|
||||
|
||||
# Run with config
|
||||
./scripts/run -- --config converge.yaml
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
| Option | Default | Description |
|
||||
|--------|---------|-------------|
|
||||
| `-r`, `--repo PATH` | `.` (cwd) | Path to the git repository |
|
||||
| `-d`, `--debounce MS` | `5000` | Debounce window in milliseconds |
|
||||
| `--remote NAME` | `origin` | Remote name to pull from |
|
||||
| `-b`, `--branch NAME` | `main` | Branch to pull |
|
||||
| `-c`, `--config FILE` | — | Path to YAML config file listing repositories |
|
||||
| `-r`, `--repo PATH` | `.` (cwd) | Path to a single git repository |
|
||||
| `-d`, `--debounce MS` | `5000` | Debounce window in milliseconds (overrides config) |
|
||||
| `--remote NAME` | `origin` | Remote name (single-repo mode) |
|
||||
| `-b`, `--branch NAME` | `main` | Branch to pull (single-repo mode) |
|
||||
|
||||
### Config file format
|
||||
|
||||
```yaml
|
||||
repos:
|
||||
- path: /absolute/or/relative/path
|
||||
remote: origin # optional, defaults to "origin"
|
||||
branch: main # optional, defaults to "main"
|
||||
- path: /another/repo
|
||||
|
||||
debounce_ms: 5000 # optional, defaults to 5000
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
@@ -48,5 +72,7 @@ All development tools run inside Docker via the `hs` wrapper script.
|
||||
|
||||
- **Language**: Haskell (GHC 9.10.3 via lts-24.38)
|
||||
- **File watching**: [fsnotify](https://hackage.haskell.org/package/fsnotify)
|
||||
- **Concurrency**: one watcher thread per repository via `async`
|
||||
- **Notifications**: shell out to `notify-send` (libnotify)
|
||||
- **Configuration**: YAML config file for multi-repo, CLI flags for single-repo
|
||||
- **Daemonization**: TBD (likely systemd service)
|
||||
|
||||
Reference in New Issue
Block a user