{"thread":{"id":"14529","subject":"Re: [JGIT PATCH 17/28] Support automatic command line parsing for TextBuiltin subclasses","startedAt":"2008-07-18T19:01:20Z","lastAt":"2008-07-18T20:38:34Z","messageCount":2,"participants":["Florian Köberle","Shawn O. Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":28},"messages":[{"id":"83910","messageId":"4880E880.1010403@web.de","threadId":"14529","inReplyTo":null,"subject":"Re: [JGIT PATCH 17/28] Support automatic command line parsing for TextBuiltin subclasses","fromName":"Florian Köberle","fromEmail":"florianskarten@web.de","sentAt":"2008-07-18T19:01:20Z","receivedAt":"2008-07-18T19:01:20Z","isPatch":true,"sender":{"key":"florianskarten@web.de","avatar":null},"body":"Hi Shawn\n\nto use args4j was really a great idea. I had a patch, implementing\nsomething similar to args4j in my repository, but using a library is\nalways better. *thumb up*\n\n\nI had a short look at the files and noticed that the inner \"if (help) {\"\nis unnecessary:\n\n+\t\tif (help) {\n+\t\t\tSystem.err.print(\"jgit \");\n+\t\t\tSystem.err.print(commandName);\n+\t\t\tclp.printSingleLineUsage(System.err);\n+\t\t\tSystem.err.println();\n+\n+\t\t\tif (help) {\n+\t\t\t\tSystem.err.println();\n+\t\t\t\tclp.printUsage(System.err);\n+\t\t\t\tSystem.err.println();\n+\t\t\t}\n+\t\t\tSystem.exit(1);\n+\t\t}\n\nAlso a cool function which you may want to use is:\n\npublic <U> Class<? extends U> asSubclass(Class<U> clazz)\n\nWith that method of Class<?> you can do the cast before you actually\ncreate the object.\nYou could for example make use of them in SubcommandHandler:\nl. 124\t\t\tcmd = (TextBuiltin) cons.newInstance();\n\nBest regards,\nFlorian Köberle\n"},{"id":"83913","messageId":"20080718203834.GA27528@spearce.org","threadId":"14529","inReplyTo":"4880E880.1010403@web.de","subject":"Re: [JGIT PATCH 17/28] Support automatic command line parsing for TextBuiltin subclasses","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-07-18T20:38:34Z","receivedAt":"2008-07-18T20:38:34Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Florian KKKberle <FloriansKarten@web.de> wrote:\n> I had a short look at the files and noticed that the inner \"if (help) {\"\n> is unnecessary:\n>\n> +\t\tif (help) {\n> +\t\t\tSystem.err.print(\"jgit \");\n> +\t\t\tSystem.err.print(commandName);\n> +\t\t\tclp.printSingleLineUsage(System.err);\n> +\t\t\tSystem.err.println();\n> +\n> +\t\t\tif (help) {\n\nGaaah.  Good catch, thanks.  I copied and pasted that block from the\nglobal option parser to the per-command parser, and then refactored\nit a little and missed removing this unnecessary inner if test.\nI'll fix with a rebase.\n\n-- \nShawn.\n"}]}