* the error stream, may be null in which case the system error stream will be used
* @throws Exception
* if an error occurs
*/
public void execute(final String[] argv, InputStream in, OutputStream out, OutputStream err) throws Exception {
final CmdLineParser clp = new CmdLineParser(this);
PrintWriter writer = new PrintWriter(err != null ? err : System.err);
try {
clp.parseArgument(argv);
} catch (CmdLineException e) {
if (argv.length > 0 && !help) {
writer.println(MessageFormat.format(CLIText.get().fatalError, e.getMessage()));
writer.flush();
throw new Die(true);
}
}
if (argv.length == 0 || help) {
final String ex = clp.printExample(ExampleMode.ALL, CLIText.get().resourceBundle());
writer.println("jgit" + ex + " command [ARG ...]"); //$NON-NLS-1$
if (help) {
writer.println();
clp.printUsage(writer, CLIText.get().resourceBundle());
writer.println();
} else if (subcommand == null) {
writer.println();
writer.println(CLIText.get().mostCommonlyUsedCommandsAre);
final CommandRef[] common = CommandCatalog.common();