output reformatted

This commit is contained in:
Timon Ringwald 2022-08-17 19:37:46 +02:00
parent 29c357bd24
commit cb1105d4f6
5 changed files with 13 additions and 1 deletions

View File

@ -1,9 +1,11 @@
package main package main
import ( import (
"fmt"
"os/exec" "os/exec"
"strings" "strings"
"git.milar.in/milarin/gmath"
"golang.org/x/exp/slices" "golang.org/x/exp/slices"
) )
@ -16,6 +18,10 @@ type CompileConfig struct {
Compress bool Compress bool
} }
func (cfg CompileConfig) String() string {
return fmt.Sprintf("%s/%s:", cfg.OS, cfg.Arch)
}
func FillCompileConfigs() error { func FillCompileConfigs() error {
cmd := exec.Command("go", "tool", "dist", "list") cmd := exec.Command("go", "tool", "dist", "list")
@ -49,6 +55,7 @@ func FillCompileConfigs() error {
FileExt: ext, FileExt: ext,
} }
MaxConfigStringLength = gmath.Max(MaxConfigStringLength, len(cfg.String()))
CompileConfigs = append(CompileConfigs, cfg) CompileConfigs = append(CompileConfigs, cfg)
} }

1
go.mod
View File

@ -4,6 +4,7 @@ go 1.19
require ( require (
git.milar.in/milarin/channel v0.0.7 git.milar.in/milarin/channel v0.0.7
git.milar.in/milarin/gmath v0.0.1
github.com/fatih/color v1.13.0 github.com/fatih/color v1.13.0
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e
) )

2
go.sum
View File

@ -1,5 +1,7 @@
git.milar.in/milarin/channel v0.0.7 h1:cVKtwgH/EE7U+XTHcoFCClJ4LR349KanzjX9xKwRcNg= git.milar.in/milarin/channel v0.0.7 h1:cVKtwgH/EE7U+XTHcoFCClJ4LR349KanzjX9xKwRcNg=
git.milar.in/milarin/channel v0.0.7/go.mod h1:We83LTI8S7u7II3pD+A2ChCDWJfCkcBUCUqii9HjTtM= git.milar.in/milarin/channel v0.0.7/go.mod h1:We83LTI8S7u7II3pD+A2ChCDWJfCkcBUCUqii9HjTtM=
git.milar.in/milarin/gmath v0.0.1 h1:pjUc1vYUE4bIky1fk0y0K347wU/9F9KtW312xkTF1YA=
git.milar.in/milarin/gmath v0.0.1/go.mod h1:HDLftG5RLpiNGKiIWh+O2G1PYkNzyLDADO8Cd/1abiE=
github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
github.com/mattn/go-colorable v0.1.9 h1:sqDoxXbdeALODt0DAeJCVp38ps9ZogZEAXjus69YV3U= github.com/mattn/go-colorable v0.1.9 h1:sqDoxXbdeALODt0DAeJCVp38ps9ZogZEAXjus69YV3U=

View File

@ -20,6 +20,8 @@ var (
ModulePath string ModulePath string
ProjectName string ProjectName string
Runner channel.Runner Runner channel.Runner
MaxConfigStringLength int
) )
// command line arguments // command line arguments

View File

@ -38,6 +38,6 @@ func PrintStates(states map[*CompileConfig]CompileState, clear bool) {
continue continue
} }
fmt.Printf("%-16s %s\n", fmt.Sprintf("%s/%s:", cfg.OS, cfg.Arch), state) fmt.Printf(fmt.Sprintf("%%-%ds %%s\n", MaxConfigStringLength), cfg.String(), state)
} }
} }