add logger and test packages

Signed-off-by: Meredith Lancaster <malancas@github.com>
This commit is contained in:
Meredith Lancaster 2024-03-01 17:52:20 -07:00
parent 7f3e818d5f
commit 82bd13b127
2 changed files with 35 additions and 0 deletions

View file

@ -0,0 +1,22 @@
package logger
import (
"fmt"
"github.com/cli/cli/v2/pkg/iostreams"
)
type Logger struct {
IO *iostreams.IOStreams
Quiet bool
Verbose bool
}
func (l *Logger) VerbosePrint(msg string) (int, error) {
if !l.verbose || !opts.IO.IsStdoutTTY() {
return 0, nil
}
return fmt.Fprintf(l.IO.ErrOut, msg)
}

View file

@ -0,0 +1,13 @@
package test
import (
"path/filepath"
"runtime"
)
func NormalizeRelativePath(posixPath string) string {
if runtime.GOOS == "windows" {
return filepath.FromSlash(posixPath)
}
return posixPath
}