Bugfixes (#13)

* several fixes:

- fix #9 + #10: switched to koanf module and dropped support for HCL
- fix #11: disabling colors on windows
- fix #12: fixed race condition in go routine call inside for loop,
  images had been downloaded multiple times
- remove hcl support and use toml format (same thing, better parser)
- update documentation and example config on TOML format of config file
- use Config as arg instead of singular args
- use x/errgroup instead of sync.Waitgroup inside image download loop

---------

Co-authored-by: Thomas von Dein <tom@vondein.org>
This commit is contained in:
T.v.Dein
2023-12-19 18:23:41 +01:00
committed by Thomas von Dein
parent ae5e3daea3
commit b8977df986
12 changed files with 394 additions and 222 deletions

13
util.go
View File

@@ -22,6 +22,9 @@ import (
"errors"
"os"
"os/exec"
"runtime"
"github.com/mattn/go-isatty"
)
func Mkdir(dir string) error {
@@ -53,3 +56,13 @@ func man() error {
return nil
}
// returns TRUE if stdout is NOT a tty or windows
func IsNoTty() bool {
if runtime.GOOS == "windows" || !isatty.IsTerminal(os.Stdout.Fd()) {
return true
}
// it is a tty
return false
}