options

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

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.

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

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type In

type In struct {
	flags.JSONFlags
	flags.ConfigFlags `flagset:"Config"`
}

func NewIn

func NewIn() (*In, error)

func (*In) Attach

func (o *In) Attach(c *cobra.Command)

func (*In) Transform

func (o *In) Transform(ctx context.Context) error

func (*In) Validate

func (o *In) Validate() []error

type Options

type Options interface {
	Validate() []error
	Transform(context.Context) error
}

func GetFromContext

func GetFromContext(ctx context.Context, key any) (Options, error)

GetFromContext returns a Options instance.

It also validates and transforms the Options instance it obtained.

It errors out if the context key does not refer an Options instance or f the validation and trasformation process errored out.

type Root

type Root struct {
	flags.ConfigFlags `flagset:"Config"`
}

func NewRoot

func NewRoot() (*Root, error)

func (*Root) Attach

func (o *Root) Attach(c *cobra.Command)

func (*Root) Transform

func (o *Root) Transform(ctx context.Context) error

func (*Root) Validate

func (o *Root) Validate() []error

type To

type To struct {
	flags.JSONFlags
	flags.ConfigFlags `flagset:"Config"`
}

func NewTo

func NewTo() (*To, error)

func (*To) Attach

func (o *To) Attach(c *cobra.Command)

func (*To) Transform

func (o *To) Transform(ctx context.Context) error

func (*To) Validate

func (o *To) Validate() []error

type Version

type Version struct {
	Verbosity int  `name:"verbosity" shorthand:"v" desc:"increment the verbosity level" type:"count" validate:"gte=0"`
	Changelog bool `name:"changelog" flag:"changelog" desc:"output the relase notes URL"`
}

func NewVersion

func NewVersion() (*Version, error)

func (*Version) Attach

func (v *Version) Attach(c *cobra.Command)

func (*Version) Transform

func (v *Version) Transform(ctx context.Context) error

func (*Version) Validate

func (v *Version) Validate() []error

Jump to

Keyboard shortcuts

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