Use custom tabwriter in version

This commit is contained in:
Ian Howell 2019-05-24 08:15:30 -05:00
parent 87fa804dab
commit d2aabc5678

View File

@ -3,9 +3,10 @@ package cmd
import ( import (
"fmt" "fmt"
"io" "io"
"text/tabwriter"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/ian-howell/airshipctl/pkg/util"
) )
// NewVersionCommand prints out the versions of airshipctl and its underlying tools // NewVersionCommand prints out the versions of airshipctl and its underlying tools
@ -15,7 +16,7 @@ func NewVersionCommand(out io.Writer) *cobra.Command {
Short: "Show the version number of airshipctl", Short: "Show the version number of airshipctl",
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
clientV := clientVersion() clientV := clientVersion()
w := tabwriter.NewWriter(out, 0, 0, 1, ' ', 0) w := util.NewTabWriter(out)
defer w.Flush() defer w.Flush()
fmt.Fprintf(w, "%s:\t%s\n", "airshipctl", clientV) fmt.Fprintf(w, "%s:\t%s\n", "airshipctl", clientV)
}, },