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

org.bitbucket.bradleysmithllc.etlunit.cli.TimeCmd Maven / Gradle / Ivy

There is a newer version: 4.1.3
Show newest version
package org.bitbucket.bradleysmithllc.etlunit.cli;

import org.clamshellcli.api.Command;
import org.clamshellcli.api.Context;
import org.clamshellcli.api.IOConsole;

import java.util.Collections;
import java.util.Date;
import java.util.Map;

public class TimeCmd implements Command {
	private static final String NAMESPACE = "syscmd";
	public static final String ACTION_NAME = "time";

	public Object execute(Context ctx) {
		IOConsole console = ctx.getIoConsole();
		console.writeOutput(String.format("%n%s%n%n",new Date().toString()));
		return null;
	}

	public void plug(Context plug) {
		// no load-time setup needed
	}

	public Command.Descriptor getDescriptor(){
		return new Command.Descriptor() {
			public String getNamespace() {return NAMESPACE;}

			public String getName() {
				return ACTION_NAME;
			}

			public String getDescription() {
				return "Prints current date/time";
			}

			public String getUsage() {
				return "Type 'time'";
			}

			public Map getArguments() {
				return Collections.emptyMap();
			}
		};
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy