public int main(List<String> args, Locale locale, InputStream stdin, OutputStream stdout, OutputStream stderr) { // remoting sets the context classloader to the RemoteClassLoader, // which slows down the classloading. we don't load anything from CLI, // so counter that effect. Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); PrintStream out = new PrintStream(stdout); PrintStream err = new PrintStream(stderr); String subCmd = args.get(0); CLICommand cmd = CLICommand.clone(subCmd); if(cmd!=null) { cmd.channel = Channel.current(); final CLICommand old = CLICommand.setCurrent(cmd); try { transportAuth = Channel.currentOrFail().getProperty(CLICommand.TRANSPORT_AUTHENTICATION); cmd.setTransportAuth(transportAuth); return cmd.main(args.subList(1,args.size()),locale, stdin, out, err); } finally { CLICommand.setCurrent(old); } } err.println("No such command: "+subCmd); new HelpCommand().main(Collections.emptyList(), locale, stdin, out, err); return -1; }
@Override protected int run() throws Exception { if (!Jenkins.getActiveInstance().hasPermission(Jenkins.READ)) { throw new AccessDeniedException("You must authenticate to access this Jenkins.\n" + CLI.usage()); } if (command != null) return showCommandDetails(); showAllCommands(); return 0; }
private int showCommandDetails() throws Exception { CLICommand command = CLICommand.clone(this.command); if (command == null) { showAllCommands(); throw new AbortException(String.format("No such command %s. Available commands are above. ", this.command)); } command.printUsage(stderr, command.getCmdLineParser()); return 0; } }
private int showCommandDetails() throws Exception { CLICommand command = CLICommand.clone(this.command); if (command == null) { showAllCommands(); throw new AbortException(String.format("No such command %s. Available commands are above. ", this.command)); } command.printUsage(stderr, command.getCmdLineParser()); return 0; } }
public int main(List<String> args, Locale locale, InputStream stdin, OutputStream stdout, OutputStream stderr) { // remoting sets the context classloader to the RemoteClassLoader, // which slows down the classloading. we don't load anything from CLI, // so counter that effect. Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); PrintStream out = new PrintStream(stdout); PrintStream err = new PrintStream(stderr); String subCmd = args.get(0); CLICommand cmd = CLICommand.clone(subCmd); if(cmd!=null) { final CLICommand old = CLICommand.setCurrent(cmd); try { return cmd.main(args.subList(1,args.size()),locale, stdin, out, err); } finally { CLICommand.setCurrent(old); } } err.println("No such command: "+subCmd); new HelpCommand().main(Collections.<String>emptyList(), locale, stdin, out, err); return -1; }
@Override protected int run() throws Exception { if (!Jenkins.getActiveInstance().hasPermission(Jenkins.READ)) { throw new AccessDeniedException("You must authenticate to access this Jenkins.\n" + hudson.cli.client.Messages.CLI_Usage()); } if (command != null) return showCommandDetails(); showAllCommands(); return 0; }
public int main(List<String> args, Locale locale, InputStream stdin, OutputStream stdout, OutputStream stderr) { // remoting sets the context classloader to the RemoteClassLoader, // which slows down the classloading. we don't load anything from CLI, // so counter that effect. Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); PrintStream out = new PrintStream(stdout); PrintStream err = new PrintStream(stderr); String subCmd = args.get(0); CLICommand cmd = CLICommand.clone(subCmd); if(cmd!=null) { final CLICommand old = CLICommand.setCurrent(cmd); try { return cmd.main(args.subList(1,args.size()),locale, stdin, out, err); } finally { CLICommand.setCurrent(old); } } err.println("No such command: "+subCmd); new HelpCommand().main(Collections.<String>emptyList(), locale, stdin, out, err); return -1; }
public int main(List<String> args, Locale locale, InputStream stdin, OutputStream stdout, OutputStream stderr) { // remoting sets the context classloader to the RemoteClassLoader, // which slows down the classloading. we don't load anything from CLI, // so counter that effect. Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); PrintStream out = new PrintStream(stdout); PrintStream err = new PrintStream(stderr); String subCmd = args.get(0); CLICommand cmd = CLICommand.clone(subCmd); if(cmd!=null) { final CLICommand old = CLICommand.setCurrent(cmd); try { return cmd.main(args.subList(1,args.size()),locale, stdin, out, err); } finally { CLICommand.setCurrent(old); } } err.println("No such command: "+subCmd); new HelpCommand().main(Collections.<String>emptyList(), locale, stdin, out, err); return -1; }
public int main(List<String> args, Locale locale, InputStream stdin, OutputStream stdout, OutputStream stderr) { // remoting sets the context classloader to the RemoteClassLoader, // which slows down the classloading. we don't load anything from CLI, // so counter that effect. Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); PrintStream out = new PrintStream(stdout); PrintStream err = new PrintStream(stderr); String subCmd = args.get(0); CLICommand cmd = CLICommand.clone(subCmd); if (cmd != null) { final CLICommand old = CLICommand.setCurrent(cmd); try { return cmd.main(args.subList(1, args.size()), locale, stdin, out, err); } finally { CLICommand.setCurrent(old); } } err.println("No such command: " + subCmd); new HelpCommand().main(Collections.<String>emptyList(), locale, stdin, out, err); return -1; }
public int main(List<String> args, Locale locale, InputStream stdin, OutputStream stdout, OutputStream stderr) { // remoting sets the context classloader to the RemoteClassLoader, // which slows down the classloading. we don't load anything from CLI, // so counter that effect. Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); PrintStream out = new PrintStream(stdout); PrintStream err = new PrintStream(stderr); String subCmd = args.get(0); CLICommand cmd = CLICommand.clone(subCmd); if(cmd!=null) { cmd.channel = Channel.current(); final CLICommand old = CLICommand.setCurrent(cmd); try { transportAuth = Channel.current().getProperty(CLICommand.TRANSPORT_AUTHENTICATION); cmd.setTransportAuth(transportAuth); return cmd.main(args.subList(1,args.size()),locale, stdin, out, err); } finally { CLICommand.setCurrent(old); } } err.println("No such command: "+subCmd); new HelpCommand().main(Collections.<String>emptyList(), locale, stdin, out, err); return -1; }