dev.jbang.catalog.CatalogItem Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jbang-cli Show documentation
Show all versions of jbang-cli Show documentation
JBang Command Line Interface
The newest version!
package dev.jbang.catalog;
import java.nio.file.Paths;
import dev.jbang.util.Util;
abstract class CatalogItem {
public transient Catalog catalog;
public CatalogItem(Catalog catalog) {
this.catalog = catalog;
}
/**
* This method returns the given scriptRef with all contextual modifiers like
* baseRefs and current working directories applied.
*/
public String resolve(String scriptRef) {
String ref = scriptRef;
if (!Util.isAbsoluteRef(ref)) {
String base = catalog.getScriptBase();
if (Util.isRemoteRef(base) || !Util.isValidPath(base)) {
ref = base + "/" + ref;
} else {
ref = Paths.get(base).resolve(ref).toString();
}
}
return ref;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy