From bd343377e2509c0638567df62366a4c4000c96fd Mon Sep 17 00:00:00 2001 From: anpig Date: Sat, 19 Aug 2023 22:03:11 +0800 Subject: [PATCH] feat: parse formatting code --- cmd/shell/main.go | 3 ++- go.mod | 1 + go.sum | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/shell/main.go b/cmd/shell/main.go index 7c80b3d..f71a5cc 100644 --- a/cmd/shell/main.go +++ b/cmd/shell/main.go @@ -9,6 +9,7 @@ import ( "strings" "github.com/willroberts/minecraft-client" + "github.com/anpig/mcfmt" ) var ( @@ -56,6 +57,6 @@ func main() { if err != nil { log.Fatal("failed to send command:", err) } - fmt.Println(resp.Body) + fmt.Println(mcfmt.Format(strings.TrimRight(resp.Body, "\n"))) } } diff --git a/go.mod b/go.mod index 4a4f422..b22c8de 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +5,7 @@ go 1.19 require github.com/stretchr/testify v1.7.0 require ( + github.com/anpig/mcfmt v0.0.0-20230819130242-70cf97a04b83 // indirect github.com/davecgh/go-spew v1.1.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect diff --git a/go.sum b/go.sum index acb88a4..cb96422 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,5 @@ +github.com/anpig/mcfmt v0.0.0-20230819130242-70cf97a04b83 h1:sHyT3CW4jv5uZPLatD2sL1woULcPF4jk3iWLRzOTj/w= +github.com/anpig/mcfmt v0.0.0-20230819130242-70cf97a04b83/go.mod h1:BRS5/rZR3puXaZfqQCd0YTd6u1ZmZpqX6Ohavn1elJk= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=