This commit is contained in:
CreativeWolf 2018-01-10 22:34:28 +00:00 committed by GitHub
commit ab8a5c6063

View file

@ -108,6 +108,8 @@ func (s *Session) getHandler(args []string, sess *Session) error {
if key == "*" { if key == "*" {
prev_ns := "" prev_ns := ""
fmt.Println()
fmt.Printf(core.Bold(" %"+strconv.Itoa(s.Env.Padding)+"s: %s"), "Parameter", "Value")
fmt.Println() fmt.Println()
for _, k := range s.Env.Sorted() { for _, k := range s.Env.Sorted() {
ns := "" ns := ""
@ -126,7 +128,9 @@ func (s *Session) getHandler(args []string, sess *Session) error {
fmt.Println() fmt.Println()
} else if found, value := s.Env.Get(key); found == true { } else if found, value := s.Env.Get(key); found == true {
fmt.Println() fmt.Println()
fmt.Printf(" %s: '%s'\n", key, value) fmt.Printf(core.Bold(" %"+strconv.Itoa(s.Env.Padding)+"s: %s\n"), "Parameter", "Value")
fmt.Println()
fmt.Printf(" %"+strconv.Itoa(s.Env.Padding)+"s: '%s'\n", key, value)
fmt.Println() fmt.Println()
} else { } else {
return fmt.Errorf("%s not found", key) return fmt.Errorf("%s not found", key)
@ -178,14 +182,14 @@ func (s *Session) registerCoreHandlers() {
"Sleep for the given amount of seconds.", "Sleep for the given amount of seconds.",
s.sleepHandler)) s.sleepHandler))
s.CoreHandlers = append(s.CoreHandlers, NewCommandHandler("get NAME", s.CoreHandlers = append(s.CoreHandlers, NewCommandHandler("get PARAMETER",
"^get\\s+(.+)", "^get\\s+(.+)",
"Get the value of variable NAME, use * for all.", "Get the value of PARAMETER, use * for all.",
s.getHandler)) s.getHandler))
s.CoreHandlers = append(s.CoreHandlers, NewCommandHandler("set NAME VALUE", s.CoreHandlers = append(s.CoreHandlers, NewCommandHandler("set PARAMETER VALUE",
"^set\\s+([^\\s]+)\\s+(.+)", "^set\\s+([^\\s]+)\\s+(.+)",
"Set the VALUE of variable NAME.", "Set the value of PARAMETER.",
s.setHandler)) s.setHandler))
s.CoreHandlers = append(s.CoreHandlers, NewCommandHandler("clear", s.CoreHandlers = append(s.CoreHandlers, NewCommandHandler("clear",