A fun Bash watcher for Dart β military-flavored feedback for beginners
Monitors main.dart for changes and responds with dramatic, sarcastic, and encouraging chatter. Great teaching tool for new Dart programmers.
- Watches
main.dartfor changes (Linux by default). - Military-style chatter for:
- Empty files (sarcastic sergeants).
- Errors (debug tips for common Dart exceptions such as
NoSuchMethodError,FormatException, etc.). - Successful runs (celebratory messages).
- Detects interactive programs and prints manual-run instructions (for
stdin.readLineSync()-style code). - Optional Believing Soldier β encouraging messages to keep you motivated.
- Idle chatter after 10 minutes of inactivity.
- Customize all chatter via files in
sgt_tmp/. - Username authentication for playful access control.
- VS Code extension in development: sgt-watch-vscode.
Create main.dart:
void main() {
print('Hello, Dart programmers!');
}You can install SGT-WATCH in multiple ways:
git clone https://github.com/BiqqMax/sgt-watch.git
cd sgt-watch
chmod +x sgt-watch.sh
./sgt-watch.shThis gives you access to all helper files (including a main.dart file).
curl -O https://raw.githubusercontent.com/BiqqMax/sgt-watch/main/sgt-watch.sh
chmod +x sgt-watch.sh
./sgt-watch.sh(This single script option runs the script directly after fetching β use with caution.)
wget https://raw.githubusercontent.com/BiqqMax/sgt-watch/main/sgt-watch.sh
chmod +x sgt-watch.sh
./sgt-watch.sh(This single script option runs the script directly after fetching β use with caution.)
git clone --no-checkout https://github.com/BiqqMax/sgt-watch.git
cd sgt-watch
git sparse-checkout init --cone
git sparse-checkout set sgt-watch.sh
git checkout main
chmod +x sgt-watch.sh
./sgt-watch.sh(This single script option runs the script directly after fetching β use with caution.)
sh -c "$(curl -fsSL https://raw.githubusercontent.com/BiqqMax/sgt-watch/main/sgt-watch.sh)"(This One-liner option runs the script directly after fetching β use with caution.)
You will see sergeant-style messages, a radio-style report of program output, and an encouraging message from the Believing Soldier if enabled.
- Dart SDK β verify with
dart --version. - Linux:
inotify-toolsandcoreutils(e.g.sudo apt-get install inotify-tools coreutils). - macOS: install
fswatch(brew install fswatch) and replace the watch command withfswatch -o \"$DART_FILE\" | while read -r; do ...in the script. - Windows: run under WSL2 and install the Linux dependencies.
- Git β
git --version.
- Run
./sgt-watch.shand enter a username when prompted (default allowed users includeadmin,commander,general,captain,lieutenant). - Edit and save your
main.dartto trigger feedback:- Empty file: sarcastic sergeant lines.
- Errors: error chatter with debug tips (e.g. βπ‘ Use try-catch with
int.parse()β). - Interactive code: instructions to run
dart main.dartmanually. - Success: celebratory messages and Believing Soldier encouragement (if enabled).
- Idle chatter starts after the configured delay (default 600 seconds / 10 minutes).
Edit variables at the top of sgt-watch.sh:
| Variable | Default | Description |
|---|---|---|
DART_FILE |
main.dart |
File to monitor |
IDLE_DELAY |
600 |
Seconds before idle chatter |
IDLE_INTERVAL |
10 |
Seconds between idle messages |
IDLE_CHATTER_COUNT |
3 |
Max idle messages |
BELIEVING_SOLDIER_ENABLED |
true |
Toggle encouraging messages |
AUTH_USERS |
admin, commander, general, captain, lieutenant |
Allowed usernames |
On first run the script creates sgt_tmp/ with these files. Edit them to change the messages used by the watcher.
output_chatters_line1.txt,output_chatters_line2.txtβ success messageserror_chatters_line1.txt,error_chatters_line2.txtβ error messagesempty_chatter_line1.txt,empty_chatter_line2.txtβ empty file messageshush_chatters.txt,hush_instructions.txtβ interactive-code messagesidle_chatters.txt,idle_notices.txtβ idle messagesbelieving_soldier_chatters.txtβ encouraging messages (if enabled)
You can use $USERNAME or $RANDOM_USER in these files to personalize messages.
- Linux-only by default (requires
inotify-tools). macOS and Windows need adjustments. - Monitors a single file by default.
- Covers common Dart errors but might miss rare cases.
- The watcher uses a 2-second timeout for runs; long-running programs may be interrupted.
- Fork the repo and create a branch:
git checkout -b my-feature - Commit your changes:
git commit -m \"Add feature\" - Push and open a pull request:
git push origin my-feature
Report issues via GitHub Issues.
MIT License
Open an issue or ping on X (Twitter): @BiqqMax β tag #SGTWatch.
VS Code extension sgt-watch-vscode is in development for seamless IDE integration.