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

com.github.jy2.commandline.picocli.node.NodeListCommand Maven / Gradle / Ivy

There is a newer version: 0.0.39
Show newest version
package com.github.jy2.commandline.picocli.node;

import java.util.ArrayList;

import com.github.jy2.commandline.picocli.Main;

import picocli.CommandLine.Command;
import picocli.CommandLine.Option;
import picocli.CommandLine.ParentCommand;

@Command(name = "list", description = "List all nodes by name")
public class NodeListCommand implements Runnable {

	@ParentCommand
	NodeCommand parent;

	@Option(names = { "--grep" }, description = "Character sequence to be expected in node name")
	String grep;

	public void run() {
		ArrayList list = Main.introspector.getNodeList();
		list.sort(String::compareToIgnoreCase);
		for (String s : list) {
			if (grep != null && !s.contains(grep)) {
				continue;
			}
			System.out.println("\t" + s);
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy