context

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 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 InKey contextKey = "in"

InKey is the key indexing the options/flags for the in subcommand.

View Source
var LongVersionKey contextKey = "version_long"

LongVersionKey is the key storing the long version.

View Source
var ShortVersionKey contextKey = "version_short"

ShortVersionKey is the key storing the short version.

View Source
var ToKey contextKey = "to"

ToKey is the key indexing the options/flags for the in subcommand.

Functions

func Error

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

func GetOptionsFromContext

func GetOptionsFromContext(ctx context.Context, key contextKey) (flags.Options, error)

GetOptionsFromContext 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