Particle
Particle is a Go-based tool designed to enhance Syncthing's ignore patterns functionality. It addresses the need for more complex ignore rules, particularly for development projects using various programming languages and frameworks.
How It Works
Particle scans specified directories and applies a series of ignore pattern checks based on the project type. It generates .stignore
files that are compatible with Syncthing, allowing for more granular control over which files and directories are synchronized.
Particle does not overwrite existing .stignore
files. It will append new ignore patterns to the existing ones.
Supported Project Types
- Rust Projects: Ignores the
target
directory when a Cargo.toml
file is present.
- Node.js Projects: Ignores
node_modules
directories.
- Dart Projects: Ignores specific Dart and Flutter-related build and cache directories.
- Python Projects: Ignores Conda environments and related files.
Installation
To install Particle, use the following Go command:
go install github.com/doraemonkeys/particle@latest
Or you can download the binary from here, and put it in your PATH
.
Usage
-
Basic usage (local directory):
particle -dir "/path/to/your/.stignore directory"
-
Using with Syncthing Web API:
particle -web -host http://127.0.0.1:8384 -user youruser
Flags:
-dir
: Target directory (for local scanning)
-web
: Get all directories from Syncthing Web API
-host
: Syncthing host (default: http://127.0.0.1:8384)
-user
: Syncthing user
-pwdFile
: Path to file containing Syncthing password
-syncthing
: Path to Syncthing executable file (used for resolving relative paths)
Web Interface
When using the -web
flag, Particle will connect to your Syncthing instance and fetch all shared directories. It will then generate appropriate .stignore
files for each directory based on its content.
Configuration
Particle uses environment variables and command-line flags for configuration. The Syncthing password can be provided via:
- A password file (specified with
-pwdFile
)
- The
SYNCTHING_PASSWORD
environment variable
- Interactive prompt (if not provided by other means)
Contributing
Contributions to Particle are welcome! Please feel free to submit pull requests, report bugs, or suggest new features through the GitHub issue tracker.
Acknowledgments
This project was inspired by the need for more complex ignore patterns in Syncthing, as discussed in Syncthing Issue #6195.