new: caplets can now include other caplets

This commit is contained in:
evilsocket 2018-01-13 14:07:37 +01:00
parent 892659ba7f
commit 1ab8711d79
3 changed files with 13 additions and 3 deletions

View file

@ -158,6 +158,10 @@ func (s *Session) clsHandler(args []string, sess *Session) error {
return nil
}
func (s *Session) includeHandler(args []string, sess *Session) error {
return s.RunCaplet(args[0])
}
func (s *Session) registerCoreHandlers() {
s.CoreHandlers = append(s.CoreHandlers, NewCommandHandler("help",
"^(help|\\?)$",
@ -198,4 +202,9 @@ func (s *Session) registerCoreHandlers() {
"^(clear|cls)$",
"Clear the screen.",
s.clsHandler))
s.CoreHandlers = append(s.CoreHandlers, NewCommandHandler("include CAPLET",
"^include\\s+(.+)",
"Load and run this caplet in the current session.",
s.includeHandler))
}