cli

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package cli defines the structures to store the CLI flags used by the scanner binary.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateFlags

func ValidateFlags(flags *Flags) error

ValidateFlags validates the passed command line flags.

Types

type Array

type Array []string

Array is a type to be passed to flag.Var that supports arrays passed as repeated flags, e.g. ./scalibr -o binproto=out.bp -o spdx23-json=out.spdx.json

func (*Array) Get

func (i *Array) Get() any

Get returns the underlying []string value stored by this flag struct.

func (*Array) Set

func (i *Array) Set(value string) error

Set gets called whenever an a new instance of a flag is read during CLI arg parsing. For example, in the case of -o foo -o bar the library will call arr.Set("foo") then arr.Set("bar").

func (*Array) String

func (i *Array) String() string

type Flags

type Flags struct {
	Root                  string
	ResultFile            string
	Output                Array
	ExtractorsToRun       string
	DetectorsToRun        string
	FilesToExtract        []string
	DirsToSkip            string
	SkipDirRegex          string
	GovulncheckDBPath     string
	SPDXDocumentName      string
	SPDXDocumentNamespace string
	SPDXCreators          string
	Verbose               bool
	ExplicitExtractors    bool
}

Flags contains a field for all the cli flags that can be set.

func (*Flags) GetSPDXConfig

func (f *Flags) GetSPDXConfig() converter.SPDXConfig

GetSPDXConfig creates an SPDXConfig struct based on the CLI flags.

func (*Flags) GetScanConfig

func (f *Flags) GetScanConfig() (*scalibr.ScanConfig, error)

GetScanConfig constructs a SCALIBR scan config from the provided CLI flags.

func (*Flags) WriteScanResults

func (f *Flags) WriteScanResults(result *scalibr.ScanResult) error

WriteScanResults writes SCALIBR scan results to files specified by the CLI flags.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL