don't print help for internal commands

This commit is contained in:
Mark Harrah 2010-11-24 14:10:48 -05:00
parent 9d6a4f70f7
commit 16e2b71ccc
2 changed files with 8 additions and 4 deletions

View File

@ -44,7 +44,9 @@ object Command
new Command { def applies = f }
def apply(f: PartialFunction[State, Apply]): Command =
direct(f.lift)
def simple(name: String, help: Help*)(f: (Input, State) => State): Command =
univ( Apply.simple(name, help : _*)(f) )
def simple(name: String, brief: (String, String), detail: String)(f: (Input, State) => State): Command =
univ( Apply.simple(name, brief, detail)(f) )
}
@ -63,8 +65,10 @@ object Apply
def simple(name: String, brief: (String, String), detail: String)(f: (Input, State) => State): State => Apply =
{
val h = Help(brief, (Set(name), detail) )
s => Apply( h ){ case in if name == in.name => f( in, s) }
simple(name, h)(f)
}
def simple(name: String, help: Help*)(f: (Input, State) => State): State => Apply =
s => Apply( help: _* ){ case in if name == in.name => f( in, s) }
}
trait Logged

View File

@ -125,11 +125,11 @@ object Commands
runExitHooks(s).reload
}
def defaults = Command.simple(DefaultsCommand, DefaultsBrief, DefaultsDetailed) { (in, s) =>
def defaults = Command.simple(DefaultsCommand) { (in, s) =>
s ++ DefaultCommands
}
def initialize = Command.simple(InitCommand, InitBrief, InitDetailed) { (in, s) =>
def initialize = Command.simple(InitCommand) { (in, s) =>
/*"load-commands -base ~/.sbt/commands" :: */readLines( readable( sbtRCs(s) ) ) ::: s
}