[#1396] cli/playground: Refactor

Signed-off-by: Alexander Chuprov <a.chuprov@yadro.com>
This commit is contained in:
Alexander Chuprov 2024-11-12 11:09:27 +03:00
parent 2f3bc6eb84
commit 80f8a8fd3a
Signed by: achuprov
GPG key ID: 2D916FFD803B0EDD

View file

@ -221,7 +221,7 @@ func (repl *policyPlaygroundREPL) run() error {
exit = true exit = true
continue continue
} }
return fmt.Errorf("reading line: %v", err) return fmt.Errorf("reading line: %w", err)
} }
exit = false exit = false
@ -230,8 +230,7 @@ func (repl *policyPlaygroundREPL) run() error {
continue continue
} }
cmd := parts[0] cmd := parts[0]
handler, exists := cmdHandlers[cmd] if handler, exists := cmdHandlers[cmd]; exists {
if exists {
if err := handler(parts[1:]); err != nil { if err := handler(parts[1:]); err != nil {
fmt.Printf("error: %v\n", err) fmt.Printf("error: %v\n", err)
} }