mirror of
https://github.com/daylinmorgan/oizys.git
synced 2024-11-09 20:33:15 -06:00
oizys-go QOL
This commit is contained in:
parent
564a38dc85
commit
00e3781049
2 changed files with 8 additions and 3 deletions
|
@ -55,7 +55,7 @@ func setupLogger() {
|
|||
log.SetReportTimestamp(false)
|
||||
styles := log.DefaultStyles()
|
||||
for k, v := range styles.Levels {
|
||||
styles.Levels[k] = v.MaxWidth(10)
|
||||
styles.Levels[k] = v.Width(5).MaxWidth(5)
|
||||
}
|
||||
log.SetStyles(styles)
|
||||
}
|
||||
|
|
|
@ -190,6 +190,7 @@ func (p *packages) summary() {
|
|||
Render(fmt.Sprint(len(p.names))),
|
||||
)
|
||||
}
|
||||
|
||||
func logCmd(cmd *exec.Cmd) {
|
||||
log.Debugf("CMD: %s", strings.Join(cmd.Args, " "))
|
||||
}
|
||||
|
@ -237,9 +238,13 @@ func parseDryRun(buf string) (*packages, *packages) {
|
|||
var parts [2][]string
|
||||
i := 0
|
||||
for _, line := range lines {
|
||||
if strings.Contains(line, "fetch") {
|
||||
if strings.Contains(line, "fetch") && strings.HasSuffix(line, ":") {
|
||||
i++
|
||||
}
|
||||
if i == 2 {
|
||||
log.Fatal("failed to parse output", "output", buf)
|
||||
}
|
||||
|
||||
if strings.HasPrefix(line, " ") {
|
||||
parts[i] = append(parts[i], line)
|
||||
}
|
||||
|
@ -247,7 +252,7 @@ func parseDryRun(buf string) (*packages, *packages) {
|
|||
|
||||
if len(parts[0])+len(parts[1]) == 0 {
|
||||
log.Info("no changes...")
|
||||
log.Fatal("or failed to parse nix build --dry-run output")
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
return parsePackages(parts[0], "packages to build"),
|
||||
|
|
Loading…
Reference in a new issue