From 3a382e73b111bdffa5ccf3b511bc6fc464c05924 Mon Sep 17 00:00:00 2001 From: 6543 <6543@noreply.gitea.io> Date: Thu, 16 Jul 2020 16:12:22 +0000 Subject: [PATCH] Fix Login List Output (#150) fix output Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: https://gitea.com/gitea/tea/pulls/150 Reviewed-by: Lunny Xiao Reviewed-by: techknowlogick --- cmd/login.go | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/cmd/login.go b/cmd/login.go index 0d34a98..bceefae 100644 --- a/cmd/login.go +++ b/cmd/login.go @@ -129,6 +129,7 @@ var cmdLoginList = cli.Command{ Usage: "List Gitea logins", Description: `List Gitea logins`, Action: runLoginList, + Flags: []cli.Flag{&OutputFlag}, } func runLoginList(ctx *cli.Context) error { @@ -137,10 +138,23 @@ func runLoginList(ctx *cli.Context) error { log.Fatal("Unable to load config file " + yamlConfigPath) } - fmt.Printf("Name\tURL\tSSHHost\n") - for _, l := range config.Logins { - fmt.Printf("%s\t%s\t%s\n", l.Name, l.URL, l.GetSSHHost()) + headers := []string{ + "Name", + "URL", + "SSHHost", } + var values [][]string + + for _, l := range config.Logins { + values = append(values, []string{ + l.Name, + l.URL, + l.GetSSHHost(), + }) + } + + Output(outputValue, headers, values) + return nil }