//// Copyright (c) 2016, Andy Frank// Licensed under the Apache License version 2.0//// History:// 22 Aug 2016 Andy Frank Creation//**** HelpCmd display command help.**constclass HelpCmd : Cmd{overrideconst Str name := "help"overrideconst Str sig := "[cmd]"overrideconst Str helpShort := "Show command help or command list overview"overrideconst Str? helpFull :="cmd Show detailed help for 'cmd'"override Int run(){ args.size > 0 ? showDetails(args.first) : showOverview}** Display command details.internal Int showDetails(Str name){ c := Cmd.get(name)if(c == null){ err("unknown command: $name") showOverviewreturn 1} info("Usage: fan studs $c.name $c.sig $c.helpShort") full := c.helpFullif(full != null){ info("") full.splitLines.each |s| { info(" $s")}}return 0}** Display help overview.internal Int showOverview(){ info("Usage: studs <cmd> [options]") info("")// find max command name length clen := 0 cmds := Cmd.list cmds.each |c| { clen = clen.max(c.name.size)} Cmd.list.each |c|{ info(" ${c.name.padr(clen)} $c.helpShort")} info("") info("Use \"studs help <cmd>\" for additional information on each command") info("")return 0}}