fmon is a command-line tool to monitor file changes in a directory and automatically rerun a specified command when changes are detected. It's designed to improve development workflows by automating the restart of processes, such as application servers, when code is modified.
- Directory Monitoring: Watches a specified directory (defaults to the current directory) for file changes.
- Automatic Command Restart: Restarts a specified command whenever a change is detected.
- Customizable Watch Directory: Use a flag to set a custom directory to monitor, accepting both relative and absolute paths.
- Colorful Console Output (WIP): Displays monitored commands, directories, and file changes in a readable neon-green format.
- Clone the repository:
git clone https://github.com/yourusername/fmon.git
cd fmon- Build the application:
go build -o fmon- Run the binary:
./fmonThe basic syntax of the fmon command is:
fmon run "<command>" [flags]- Monitor Current Directory:
To monitor the current directory and rerun a command (e.g., go run main.go) whenever a file changes:
fmon run "go run main.go"- Monitor a Custom Directory:
To specify a different directory to monitor (relative or absolute path), use the --dir or -d flag:
fmon run "go run main.go" --dir "./path/to/dir"--dir,-d: Specify a directory to watch. Defaults to the current directory.
Command: go run main.go
Watching directory: /path/to/project
File modified: /path/to/project/main.goThis project uses watcher to monitor file changes and Cobra for CLI functionality. To modify or extend fmon, explore the main files and directories:
- cmd/: Contains CLI commands and flags.
- watcher/: Manages file monitoring and detects changes.
- process/: Handles running and restarting commands.
Contributions are welcome! Please fork the repository and submit a pull request for any features, bug fixes, or improvements.