public void exec(CLIContext cli, String[] args) throws Exception { if (args.length > 1) { Thread.sleep(Long.parseLong(args[1]) * 1000); } else { cli.println("Usage: sleep number-of-seconds"); } } }
public void exec(CLIContext ctx, String[] args) { ctx.println(new Date().toString()); } }
public void printThrowable(Throwable t) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); t.printStackTrace(new PrintStream(baos)); println (baos.toString()); }
public void exec(CLIContext ctx, String[] args) throws IOException { if (args.length != 2) { ctx.println (String.format ("Usage: %s<path-to-dump-directory>", args[0])); return; } File dir = new File(args[1]); if (!dir.canWrite()) { ctx.println ("Unable to write " + dir.getAbsolutePath()); return; } dumpMetrics (dir); }
private void showOne(CLIContext cli, String name, boolean detail) { try { Object obj = NameRegistrar.get(name); cli.println(name + " : " + obj.toString()); if (detail && obj instanceof Loggeable) { cli.printLoggeable((Loggeable) obj, ""); } } catch (NameRegistrar.NotFoundException e) { cli.println("Object not found in NameRegistrar"); } }
public void exec(CLIContext cli, String[] args) { String s = ISOUtil.unPadLeft(args[0].substring(4), ' '); cli.println(s); } }
public void printLoggeable(Loggeable l, String indent) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); l.dump (new PrintStream(baos), indent); println (baos.toString()); }
public void exec(CLIContext ctx, String[] args) throws Exception { if (args.length < 2) { ctx.println (String.format ("Usage: %span(s)", args[0])); return; } DefaultLUHNCalculator calc = new DefaultLUHNCalculator(); for (int i=1; i<args.length; i++) ctx.println(String.format("%s%c", args[i], calc.calculate(args[i]))); } }
public void exec(CLIContext cli, String[] args) { cli.println(Q2.getVersionString()); } }
public void exec(CLIContext cli, String[] args) throws IOException { InputStream input = new BufferedInputStream(getClass().getResourceAsStream("/LICENSE")); try { display(cli, input); } finally { input.close(); } cli.println(""); }
public void usage(CLIContext cli) { cli.println("Usage: tail [log-name] [log-name] ..."); showLoggers(cli); }
@Override public String getPrompt(CLIContext ctx, String[] args) { if (args.length < 2) { ctx.println ("Usage: binlog directory-name"); return null; } ctx.getUserData().put("binlog", args[1]); return String.format("(%s)> ", new File(args[1]).getName()); }
public void update(TransactionStatusEvent e) { cli.println(e.toString()); } }
public void usage(CLIContext cli) { cli.println("Usage: tmmon [tm-name] [tm-name] ..."); showTMs(cli); }
private void encrypt (CLIContext cli, String clear) throws Exception { SecureData sd = cs.aesEncrypt(clear.getBytes()); cli.println (sd.getId() + " " + Base64.getEncoder().encodeToString(sd.getEncoded())); } }
public void exec(CLIContext cli, String[] args) throws Exception { Terminal term = cli.getReader().getTerminal(); cli.println("TERM=" + term.getClass().getSimpleName() + "/" + term.getType()); } }
@Override public void exec(CLIContext cli, String[] args) throws Exception { cs = NameRegistrar.getIfExists("crypto-service"); if (args.length != 2) { usage(cli); if (cs == null) cli.println ("'crypto-service' not registered"); return; } encrypt(cli, args[1]); }
@Override public void exec(CLIContext ctx, String[] args) throws Exception { Q2 q2 = ctx.getCLI().getQ2(); File deployDir = q2.getDeployDir(); ctx.println(printDirectoryTree(deployDir)); return; }
public void exec(CLIContext ctx, String[] args) throws Exception { ctx.println(ISOUtil.millisToString(ctx.getCLI().getQ2().getUptime())); } }