From 69184468ec419162f090784d7e41739b3caccc8e Mon Sep 17 00:00:00 2001 From: "takahiro.tominaga" Date: Sun, 12 Feb 2023 20:27:54 +0900 Subject: [PATCH] =?UTF-8?q?docs:=20example=20=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- util/stdout_format_test.go | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 util/stdout_format_test.go diff --git a/util/stdout_format_test.go b/util/stdout_format_test.go new file mode 100644 index 0000000..a7e93ff --- /dev/null +++ b/util/stdout_format_test.go @@ -0,0 +1,31 @@ +package util_test + +import ( + "github.com/android-project-46group/sgi-cli/util" +) + +func ExamplePrintTable() { + var header []string + var data [][]string + header = []string{ + "id", + "name", + } + data = append(data, []string{ + "1", + "John", + }) + data = append(data, []string{ + "2", + "Doe", + }) + util.PrintTable(header, data) + + // Output: + // +----+------+ + // | ID | NAME | + // +----+------+ + // | 1 | John | + // | 2 | Doe | + // +----+------+ +}