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

com.github.jy2.commandline.picocli.param.ParamGetCommand Maven / Gradle / Ivy

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

import java.io.IOException;

import com.github.jy2.commandline.picocli.Main;
import com.github.jy2.commandline.picocli.param.completion.ParameterNameCompletionCandidates;

import picocli.CommandLine.Command;
import picocli.CommandLine.Parameters;
import picocli.CommandLine.ParentCommand;

@Command(name = "get", description = "Print parameter value on screen")
public class ParamGetCommand implements Runnable {

	@ParentCommand
	ParamCommand parent;

	@Parameters(index = "0", description = "Name of the parameter", completionCandidates = ParameterNameCompletionCandidates.class)
	String parameterName;

	public void run() {
		Object paramValue;
		try {
			paramValue = Main.di.getParameterClient().getParameter(parameterName);
		} catch (IOException e) {
			e.printStackTrace();
			return;
		}
		System.out.println(paramValue.toString());
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy