@@ -22,11 +22,14 @@ import (
2222var _ = fmt .Print
2323
2424// watch_dir starts fswatcher in a background goroutine and pipes events to a custom channel.
25- func watch_dir (ctx context.Context , path string , debounce time.Duration , eventChan chan <- fswatcher.WatchEvent ) error {
26- w , err := fswatcher .New (
27- fswatcher .WithPath (path ),
25+ func watch_dirs (ctx context.Context , paths []string , debounce time.Duration , eventChan chan <- fswatcher.WatchEvent ) error {
26+ opts := []fswatcher.WatcherOpt {
2827 fswatcher .WithCooldown (debounce ),
29- )
28+ }
29+ for _ , path := range paths {
30+ opts = append (opts , fswatcher .WithPath (path ))
31+ }
32+ w , err := fswatcher .New (opts ... )
3033 if err != nil {
3134 return err
3235 }
@@ -108,10 +111,9 @@ func watch_for_kitty_config_changes(action func() error, debounce_time time.Dura
108111 }
109112 return nil
110113 }
111- for _ , path := range dirs_to_watch {
112- if err := watch_dir (ctx , path , debounce_time , event_chan ); err != nil {
113- return err
114- }
114+
115+ if err := watch_dirs (ctx , dirs_to_watch , debounce_time , event_chan ); err != nil {
116+ return err
115117 }
116118 stdinClosed := make (chan struct {})
117119 go func () {
0 commit comments