« Return to Thread: one bug, one feature, one puff of smoke

Re: one bug, one feature, one puff of smoke

by Paul LaCrosse :: Rate this Message:

Reply to Author | View in Thread

This updated showHelp method for the commandline.scala file may work (note: no guarantee that other changes not needed to be made elsewhere in your source)

        def showHelp(out : PrintStream) : Unit = {
                var width = 0
                for(i <- opts) {
                        val w = i.longName.length
                        if(w > width) width = w
                }
                width += 2

                out.print(helpHeader)
                for(i <- opts) {
                        if (i.shortName != None) out.print("  -" + i.shortName.get) else out.print("    ")
                        out.print("  --")
                        out.print(i.longName)
                        for(j <- Iterator.range(0, width - i.longName.length))
                                out.print(' ')
                        out.println(i.description)
                }
        }


Paul Phillips wrote:
a) There's a bug in CommandLineParser that causes it to print short options
in help text as Some(c) instead of just c.

 « Return to Thread: one bug, one feature, one puff of smoke