context

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 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.

Index

Constants

This section is empty.

Variables

View Source
var ConfigKey contextKey = "cfg"

ConfigKey is the key indexing the configuration options in the contexts.

View Source
var ContextCancelFuncKey contextKey = "ctxcancel"

ContextCancelFuncKey is the key indexing the context cancelation function in the context itself.

View Source
var IOStreamsKey contextKey = "iostreams"

IOStreamsKey is the key storing the IOStreams (stdout, stderr, stdin).

View Source
var InKey contextKey = "in"

InKey is the key indexing the options for the `in` child command.

View Source
var RegistryKey contextKey = "registry"

RegistryKey is the key indexing the registry flags values.

View Source
var ScanKey contextKey = "scan"

ScanKey is the key indexing the options for the `scan` child command.

View Source
var ToKey contextKey = "to"

ToKey is the key indexing the options for the `to` child command.

View Source
var VersionKey contextKey = "version"

VersionKey is the key indexing the options for the `version` child command.

View Source
var VersionLongKey contextKey = "version_long"

VersionLongKey is the key storing the long version.

View Source
var VersionShortKey contextKey = "version_short"

VersionShortKey is the key storing the short version.

View Source
var VersionTagKey contextKey = "version_tag"

VersionTagKey is the key storing the tag part of the version.

View Source
var VersionsCollection contextKey = "versionscollection"

VersionsCollection is the key indexing a versions collection.

Functions

func Error

func Error(ctx context.Context, input error) error

func GetOptionsFromContext

func GetOptionsFromContext(ctx context.Context, key any) (cmd.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.

func OutputError

func OutputError(ctx context.Context, input error) error

func OutputErrorf

func OutputErrorf(ctx context.Context, input error, format string, a ...any) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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