Documentation ¶
Overview ¶
SPDX-License-Identifier: Apache-2.0
Copyright © 2023 The listen.dev team <engineering@garnet.ai>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright © 2023 The listen.dev team <engineering@garnet.ai>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright © 2023 The listen.dev team <engineering@garnet.ai>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright © 2023 The listen.dev team <engineering@garnet.ai>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Variables
- func AsJSON(o interface{}) string
- func Define(c *cobra.Command, o interface{}, startingGroup string, exclusions []string)
- func GetDefaults(o interface{}) map[string]string
- func GetField(o interface{}, name string) reflect.Value
- func GetFieldTag(o interface{}, name string) (reflect.StructTag, bool)
- func GetNames(o interface{}) map[string]string
- func GetTypes(o interface{}) map[string]reflect.Type
- func Transform(ctx context.Context, o interface{}) error
- func Translate(err error, prefix string) []error
- func Validate(o interface{}) []error
- type ConfigFlags
- type DebugFlags
- type Endpoint
- type Filtering
- type GitHub
- type Ignore
- type JSONFlags
- type Pull
- type Registry
- type Reporting
- type Token
- type TokenMandatory
Constants ¶
This section is empty.
Variables ¶
var EnvPrefix = "lstn"
EnvPrefix is the prefix of the env variables corresponding to the global flags.
var EnvReplacer = strings.NewReplacer("-", EnvSeparator, ".", EnvSeparator)
EnvReplacer is the string replacer that defines the transformation for flag names into environment variable names.
var EnvSeparator = "_"
EnvSeparator is the separator between the env variable prefix and the global flag name.
Functions ¶
func GetDefaults ¶ added in v0.1.0
func GetFieldTag ¶ added in v0.13.0
Types ¶
type ConfigFlags ¶ added in v0.1.0
type ConfigFlags struct { LogLevel string `default:"info" name:"log level" flag:"loglevel" desc:"set the logging level" flagset:"Config" json:"loglevel"` // TODO > validator Timeout int `` // FIXME: change to time.Duration type /* 134-byte string literal not displayed */ Endpoint Endpoint `json:"endpoint"` Token Registry Reporting Filtering Lockfiles []string `` /* 199-byte string literal not displayed */ }
ConfigFlags are the options that the CLI also reads from the YAML configuration file.
func NewConfigFlags ¶ added in v0.1.0
func NewConfigFlags() (*ConfigFlags, error)
func (*ConfigFlags) Define ¶ added in v0.4.0
func (o *ConfigFlags) Define(c *cobra.Command, exclusions []string)
func (*ConfigFlags) SetDefaults ¶ added in v0.5.0
func (o *ConfigFlags) SetDefaults()
func (*ConfigFlags) Transform ¶ added in v0.1.0
func (o *ConfigFlags) Transform(ctx context.Context) error
func (*ConfigFlags) Validate ¶ added in v0.1.0
func (o *ConfigFlags) Validate() []error
type DebugFlags ¶ added in v0.4.0
type DebugFlags struct {
DebugOptions bool `name:"debug options" flag:"debug-options" desc:"output the options, then exit" json:"debug-options"`
}
type Ignore ¶ added in v0.6.0
type Ignore struct { Packages []string `` /* 143-byte string literal not displayed */ Deptypes []npmdeptype.Enum `` /* 148-byte string literal not displayed */ // contains filtered or unexported fields }
type JSONFlags ¶
type JSONFlags struct { JSON bool `name:"json" flag:"json" desc:"output the verdicts (if any) in JSON form" json:"json"` JQ string `` /* 173-byte string literal not displayed */ }
type Pull ¶ added in v0.4.0
type Pull struct {
ID int `name:"github pull request ID" flag:"gh-pull-id" desc:"set the GitHub pull request ID" flagset:"Reporting" json:"gh-pull-id"`
}
type Registry ¶ added in v0.4.0
type Registry struct {
NPM string `` /* 195-byte string literal not displayed */
}
type Reporting ¶ added in v0.6.0
type Reporting struct { Types []cmd.ReportType `json:"reporter" flag:"reporter" shorthand:"r" transform:"unique" desc:"set one or more reporters to use" flagset:"Reporting"` GitHub // contains filtered or unexported fields }
NOTE > Struct can't have the same name of a flag.
type TokenMandatory ¶ added in v0.16.0
type TokenMandatory struct { GitHub string `name:"GitHub token" flag:"gh-token" desc:"set the GitHub token" flagset:"Token" json:"gh-token" validate:"mandatory"` JWT string `name:"JWT token" flag:"jwt-token" desc:"set the listen.dev auth token" flagset:"Token" json:"jwt-token" validate:"mandatory"` }