Alfred is a lightweight tool that automatically watches for changes in your Go files and triggers specified command in alfred_config.json under key value build_command. Designed to streamline your development process, Alfred ensures your build stays updated with every modification.
- Monitors a directory for changes in
.gofiles. - Automatically runs
build_command(specified build command) when a change is detected. - Excludes irrelevant files like
.gitand.exe. - Configurable build output via
alfred_config.json.
- Go installed on your system.
- Clone this repository and navigate to the project folder.
-
Clone the repository and build the executable:
git clone https://github.com/yourusername/alfred.git cd alfred go build -o alfred -
Add the generated
alfredexecutable to your system's PATH:- Linux/macOS:
export PATH=$PATH:/path/to/alfred
- Windows:
Add the directory containing
alfred.exeto your environment variables' PATH.
- Linux/macOS:
-
Navigate to the project directory where you want Alfred to watch for changes:
cd /path/to/your/project -
Run the Alfred executable:
alfred
-
To customize the behavior, create an
alfred_config.jsonfile in your project directory:{ "build_name": "your_custom_build_name", "build_version": "1.0.0", "build_command": "go run main.go", "Watch_files": [".go"] } -
When Alfred detects changes in
.gofiles, it will automatically:- Build the project.
- Use the custom executable name specified in your
alfred_config.json(if present). - Default to the name
alfredif no custom configuration is provided.
main.go- Core logic to monitor files and trigger build commands.logger.go- Configures logging using Zap.config_parser.go- Parses thealfred_config.jsonconfiguration file.alfred_config.json- Configuration file for build settings.
You can customize the build command by editing the alfred_config.json file:
{
"build_name": "your_custom_build_name",
"build_version": "1.0.0",
"build_command": "go run main.go",
"Watch_files": [".go"]
}- Modify
example.goin the directory. - Alfred detects the change and runs:
go build -o alfred
This project is licensed under the MIT License. See the LICENSE file for details.