Commit 3e1ba52b authored by Michał Flendrich's avatar Michał Flendrich
Browse files

addon/*: move tabWidth definition to local scope.

This seemingly introduces duplication, but IMO this constant is a style implementation detail that doesn't make much sense to share between different places.
Column-based pretty-printing looks depend on the exact data being shown. If we think that it's the same data being printed in both places, then we should extract & share a bigger chunk of code than just one const.
parent e2e82f8c
Showing with 2 additions and 6 deletions
+2 -6
......@@ -20,6 +20,7 @@ func init() {
}
func addonListRun(cmd *cobra.Command, args []string) {
const tabWidth = 4
w := tabwriter.NewWriter(os.Stdout, 0, 0, tabWidth, ' ', 0)
addons := addons.List()
......
......@@ -35,6 +35,7 @@ func addonShowRun(cmd *cobra.Command, args []string) {
log.Fatal(err)
}
const tabWidth = 4
w := tabwriter.NewWriter(os.Stdout, 0, 0, tabWidth, ' ', 0)
fmt.Fprintf(w, "Name\t%s\n", addon.Name)
......
package main
const (
// tabWidth is the number of spaces between tabWriter columns.
tabWidth = 4
)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment