Source:
public static void main(String[] args) { Main.out = System.out; Main.err = System.err; PrintStream VoidStream = new PrintStream(new OutputStream() { @Override public void write(int b) throws IOException @Override public void write(byte[] b) throws IOException @Override public void write(byte[] b, int off, int len) throws IOException @Override public void flush() throws IOException @Override public void close() throws IOException }); System.setOut(VoidStream); System.setErr(VoidStream); if (args.length == 0) { die("No command specified", true, null, null); } String name = args[0]; if ("-h".equals(name) || "--help".equals(name)) { showUsage(); System.exit(0); } Command command = Registry.getCommandByName(name); if (command == null) { die("Unknown command: " + name, true, null, null); } boolean debug = false; Options options = mergeOptions(OPTIONS, command.getOptions()); try { String[] cargs = Arrays.copyOfRange(args, 1, args.length); Options opts = mergeOptions(OPTIONS, command.getOptions()); boolean extra = command.supportsExtraArgs(); CommandLineParser parser = new PosixParser(); CommandLine cmd = parser.parse(opts == null ? new Options() : opts, cargs, extra); if (cmd.hasOption('h')) { showUsage(name, command); System.exit(0); } if (cmd.hasOption("no-color")) { System.setProperty("DISABLE_COLORS", "true"); } debug = cmd.hasOption("debug"); command.execute(cmd); } catch (ParseException ex) { if (debug) ex.printStackTrace(Main.err); die("Invalid arguments: " + ex.getMessage(), true, name, command); } catch (Throwable th) { if (debug) th.printStackTrace(Main.err); String errorMsg = th.getClass().getSimpleName(); String errorDetails = th.getMessage(); if (errorDetails != null && !errorDetails.isEmpty()) { errorMsg += ": " + errorDetails; } die(errorMsg, false, name, command); } }

Target:
public static void main(String[] args) { Main.out = System.out; Main.err = System.err; PrintStream VoidStream = new PrintStream(new OutputStream() { @Override public void write(int b) throws IOException @Override public void write(byte[] b) throws IOException @Override public void write(byte[] b, int off, int len) throws IOException @Override public void flush() throws IOException @Override public void close() throws IOException }); System.setOut(VoidStream); System.setErr(VoidStream); if (args.length == 0) { die("No command specified", true, null, null); } String name = args[0]; if ("-h".equals(name) || "--help".equals(name)) { showUsage(); System.exit(0); } Command command = Registry.getCommandByName(name); if (command == null) { die("Unknown command: " + name, true, null, null); } boolean debug = false; Options options = mergeOptions(OPTIONS, command.getOptions()); try { String[] cargs = Arrays.copyOfRange(args, 1, args.length); Options opts = mergeOptions(OPTIONS, command.getOptions()); boolean extra = command.supportsExtraArgs(); CommandLineParser parser = new PosixParser(); CommandLine cmd = parser.parse(opts == null ? new Options() : opts, cargs, extra); if (cmd.hasOption('h')) { showUsage(name, command); System.exit(0); } if (cmd.hasOption("no-color")) { System.setProperty("DISABLE_COLORS", "true"); } debug = cmd.hasOption("debug"); command.execute(cmd); } catch (ParseException ex) { if (debug) ex.printStackTrace(Main.err); die("Invalid arguments: " + ex.getMessage(), true, name, command); } catch (Throwable th) { if (debug) th.printStackTrace(Main.err); die(th, false, name, command); } }