public static Path getCatalogFile(Path catFile) {
		if (catFile == null) {
			Catalog catalog = findNearestCatalog(Util.getCwd());
			if (catalog != null && !catalog.catalogRef.isClasspath()) {
				catFile = catalog.catalogRef.getFile();
			} else {
				// This is here as a backup for when the user catalog doesn't
				// exist yet, because `findNearestCatalog()` only returns
				// existing files
				catFile = Settings.getUserCatalogFile();
			}
		}
		return catFile;
	}
Will either return the given catalog or search for the nearest catalog
starting from cwd.

@param catFile The catalog to return or null to return the nearest catalog
@return Path to a catalog
src/main/java/dev/jbang/catalog/Catalog.java