cli

package
v0.51.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2021 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Overview

Package cli contains utilities for cobra.Command objects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CobraBindEnvironmentVariables

func CobraBindEnvironmentVariables(prefix string) func(cmd *cobra.Command, _ []string)

CobraBindEnvironmentVariables can be used at the root command level of a cobra CLI hierarchy to allow all command-line variables to be set by environment variables as well. Note that skewered-variable-names will automatically be translated to skewered_variable_names for compatibility with environment variables.

In addition, you can pass in an application name prefix such that all environment variables will need to start with PREFIX_ to be picked up as valid environment variables. For example, if you specified the prefix as "availability", then the program would only detect environment variables like "AVAILABILITY_KAFKA_BROKER" and not "KAFKA_BROKER". There is no need to capitalize the prefix name.

Note: CLI arguments (eg --address=localhost) will always take precedence over environment variables

Types

This section is empty.

Jump to

Keyboard shortcuts

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