add logger and test packages
Signed-off-by: Meredith Lancaster <malancas@github.com>
This commit is contained in:
parent
7f3e818d5f
commit
82bd13b127
2 changed files with 35 additions and 0 deletions
22
pkg/cmd/attestation/logger/logger.go
Normal file
22
pkg/cmd/attestation/logger/logger.go
Normal 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)
|
||||
}
|
||||
|
||||
13
pkg/cmd/attestation/test/path.go
Normal file
13
pkg/cmd/attestation/test/path.go
Normal 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
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue