private void watchForChanges(Path orginalFile, Callable<Object> action) throws IOException {
		try (final WatchService watchService = FileSystems.getDefault().newWatchService()) {
			Path watched = orginalFile.toAbsolutePath().getParent();
			watched.register(watchService,
					StandardWatchEventKinds.ENTRY_MODIFY);
			info("Watching for changes in " + watched);
			while (true) {
				final WatchKey wk = watchService.take();
				for (WatchEvent<?> event : wk.pollEvents()) {
					// we only register "ENTRY_MODIFY" so the context is always a Path.
					// but relative to the watched directory
					final Path changed = watched.resolve((Path) event.context());
					verboseMsg("Changed file: " + changed.toString());
					if (Files.isSameFile(orginalFile, changed)) {
						try {
							freshly(action);
						} catch (RuntimeException ee) {
							warn("Error when re-generating project. Ignoring it, but state might be undefined: "
									+ ee.getMessage());
						} catch (Exception e) {
							throw new ExitException(EXIT_GENERIC_ERROR, "Exception when re-generating project. Exiting",
									e);
						}
					}
				}
				// reset the key
				boolean valid = wk.reset();
				if (!valid) {
					warn("edit-live file watch key no longer valid!");
				}
			}
		} catch (InterruptedException e) {
			warn("edit-live interrupted");
		}
	}
Returns a parent path if one of the targetFileNames exist in such parent.

@param filePath
@param targetFileNames list of markers to search for
@return if found returns the marker path, if none found return null.
src/main/java/dev/jbang/cli/Edit.java