Documentation ¶
Index ¶
- Constants
- Variables
- func CacheLicensesFile(basedir string, spdxFileBytes *[]byte, overwrite bool) error
- func DeleteFile(path string) error
- func DoRequest(client *http.Client, request *http.Request) (*[]byte, error)
- func Filter[T any](input []T, predicate Predicate[T]) []T
- func GetHomeDir(basedir string) string
- func GetInProgressFilePath(basedir string) string
- func GetLicensesFilePath(basedir string) string
- func GetSupportedLicenses(basedir string) (*[]string, error)
- func LoadFile(filePath string) ([]byte, error)
- func Marshal(path string, m *map[string]any, args ...any) error
- func MkHomeDir(basedir string) error
- func MkHttpClient() *http.Client
- func MkJSONRequest(method string, url string) (*http.Request, error)
- func MkPrompt(stdin *io.ReadCloser, stdout *io.WriteCloser, text string, ...) (*string, error)
- func NewPersonOrOrganizationPrompt(reader *Reader, writer *Writer, label string) (*map[string]any, error)
- func NewTestHttpClient(responses *Stack[string]) *http.Client
- func Nop(s string) error
- func ReadJSON(path string) (*string, error)
- func Unmarshal(path string) (*map[string]any, error)
- func ValidEmailAddress(address string) error
- func ValidUrl(str string) error
- func WriteJSON(path string, json string) error
- type Predicate
- type Reader
- type Stack
- type StdinReader
- type StdoutWriter
- type TestReader
- type TestRoundTripper
- type TestStdin
- type TestWriter
- type Writer
Constants ¶
View Source
const (
SPDXLicensesURL = "https://raw.githubusercontent.com/spdx/license-list-data/master/json/licenses.json"
)
Variables ¶
View Source
var NilStack = &Stack[string]{nil, 0}
View Source
var UserHomeDir, _ = getUserHomeDir()
Functions ¶
func CacheLicensesFile ¶
converts the full SPDX JSON file into a JSON file of licenseId => reference and store it
func DeleteFile ¶
func GetHomeDir ¶
func GetInProgressFilePath ¶
func GetLicensesFilePath ¶
func GetSupportedLicenses ¶
func MkHttpClient ¶
func MkPrompt ¶
func MkPrompt(stdin *io.ReadCloser, stdout *io.WriteCloser, text string, validate func(string) error) (*string, error)
func ValidEmailAddress ¶
Types ¶
type Reader ¶
type Reader interface {
Stdin() io.ReadCloser
}
type StdinReader ¶
type StdinReader struct {
Reader
}
func (*StdinReader) Stdin ¶
func (*StdinReader) Stdin() io.ReadCloser
type StdoutWriter ¶
type StdoutWriter struct {
Writer
}
func (StdoutWriter) StdErr ¶
func (StdoutWriter) StdErr() io.WriteCloser
func (StdoutWriter) Stdout ¶
func (StdoutWriter) Stdout() io.WriteCloser
type TestReader ¶
func (*TestReader) Stdin ¶
func (r *TestReader) Stdin() io.ReadCloser
type TestRoundTripper ¶
type TestStdin ¶
type TestStdin struct { io.ReadCloser Data Stack[string] // contains filtered or unexported fields }
type TestWriter ¶
func (TestWriter) StdErr ¶
func (r TestWriter) StdErr() io.WriteCloser
func (TestWriter) Stdout ¶
func (r TestWriter) Stdout() io.WriteCloser
Click to show internal directories.
Click to hide internal directories.