All Downloads are FREE. Search and download functionalities are using the official Maven repository.

info.unterrainer.commons.jreutils.JreUtils Maven / Gradle / Ivy

There is a newer version: 0.3.15
Show newest version
package info.unterrainer.commons.jreutils;

import java.io.IOException;

import info.unterrainer.commons.cliutils.Arg;
import info.unterrainer.commons.cliutils.Cli;
import info.unterrainer.commons.cliutils.CliParser;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class JreUtils {

	public static void main(final String[] args) throws IOException {
		Cli cli = CliParser.cliFor(args, "JreUtils", "A library of JRE helper tools.")
				.addArg(Arg.String("path")
						.shortName("p")
						.description("the relative path to get the resources-list from")
						.optional())
				.addArg(Arg.String("endswith")
						.shortName("e")
						.description("adds a filter to the list of scanned files: endswith(ARG)"))
				.create();

		if (cli.isHelpSet())
			System.exit(0);

		String path = "";
		if (cli.isArgSet("path"))
			path = cli.getArgValue("path");

		if (cli.isArgSet("endswith")) {
			String ew = cli.getArgValue("endswith");
			log.info("adding endswith [{}]", ew);
			Resources.walk(JreUtils.class, path, p -> p.toString().endsWith(ew));
		} else
			Resources.walk(JreUtils.class, path);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy