3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/tldr/watcher.rb', line 3
def watch config
require_fs_watch!
tldr_command = "#{"bundle exec " if defined?(Bundler)}tldr #{config.to_full_args(ensure_args: ["--i-am-being-watched"])}"
command = "fswatch -o #{config.load_paths.reverse.join(" ")} | xargs -n1 -I{} #{tldr_command}"
print <<~MSG.chomp
Waiting for changes in --load-path directories: #{config.load_paths.map(&:inspect).join(", ")}
When a file changes, TLDR will run this command:
$ #{tldr_command}
Watching...
MSG
exec command
end
|