watch method
Watch mode - auto-regenerate when source files change
Monitors the source directory for changes and automatically regenerates output files when files are modified.
Implementation
@cliCommand
Future<void> watch({
/// Source directory to watch (default: auto-detect)
String? source,
/// Project type: auto, dart, python, javascript, typescript, go, rust, java, kotlin, swift, cpp, csharp, ruby, php, web, generic
String? type,
/// Output file prefix (default: CLAUDIO)
String? prefix,
/// Maximum size per output file in KB (default: 1000)
int? maxSize,
/// Remove comments from output (default: true)
bool? removeComments,
/// Output format: text, markdown, or json (default: text)
String? format,
/// Load settings from a saved profile
String? profile,
/// Show verbose output
bool verbose = false,
}) async {
try {
// Build configuration
final config = await _buildConfig(
source: source,
type: type,
prefix: prefix,
maxSize: maxSize,
removeComments: removeComments,
format: format,
profile: profile,
verbose: verbose,
);
// Start watching
final watcher = FileWatcher(config);
await watcher.startWatching();
} catch (e) {
error('Watch mode failed: $e');
exit(1);
}
}