Documentation
¶
Overview ¶
Copyright © 2019 Doppler <support@doppler.com>
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.
Copyright © 2024 Doppler <support@doppler.com>
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.
Copyright © 2020 Doppler <support@doppler.com>
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.
Copyright © 2020 Doppler <support@doppler.com>
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.
Copyright © 2021 Doppler <support@doppler.com>
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.
Copyright © 2019 Doppler <support@doppler.com>
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.
Copyright © 2022 Doppler <support@doppler.com> 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.
Copyright © 2023 Doppler <support@doppler.com>
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.
Copyright © 2020 Doppler <support@doppler.com>
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.
Copyright © 2023 Doppler <support@doppler.com>
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.
Copyright © 2022 Doppler <support@doppler.com> 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.
Copyright © 2022 Doppler <support@doppler.com>
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.
Copyright © 2019 Doppler <support@doppler.com>
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
- Variables
- func CanLogDebug() bool
- func CanLogInfo() bool
- func Clamp[T constraints.Ordered](x, min, max T) T
- func ConfigDir() string
- func ConfirmationPrompt(message string, defaultValue bool) bool
- func Contains[T comparable](s []T, e T) bool
- func CopyToClipboard(text string) error
- func CreateNamedPipe(path string, mode uint32) error
- func Cwd() string
- func DotNETNameTransform(name string) string
- func ErrExit(e error, exitCode int, messages ...string)
- func Exists(path string) bool
- func FileOwnership(path string) (int, int, error)
- func FilterMap[T any](origMap map[string]T, keysToSelect []string) map[string]T
- func GetBool(value string, def bool) bool
- func GetBoolFlag(cmd *cobra.Command, flag string) bool
- func GetBoolFlagIfChanged(cmd *cobra.Command, flag string, def bool) bool
- func GetDurationFlag(cmd *cobra.Command, flag string) time.Duration
- func GetDurationFlagIfChanged(cmd *cobra.Command, flag string, def time.Duration) time.Duration
- func GetFilePath(fullPath string) (string, error)
- func GetFlagIfChanged(cmd *cobra.Command, flag string, def string) string
- func GetIntFlag(cmd *cobra.Command, flag string, bits int) int
- func GetPathFlagIfChanged(cmd *cobra.Command, flag string, def string) string
- func GetStdIn() (*string, error)
- func HandleError(e error, messages ...string)
- func HasDataOnStdIn() (bool, error)
- func HomeDir() string
- func HostArch() string
- func HostOS() string
- func IsDotNETSettingsFile(fileName string) bool
- func IsMINGW64() bool
- func IsMacOS() bool
- func IsProcessRunning(p *os.Process) bool
- func IsValidUUID(s string) bool
- func IsWindows() bool
- func Log(info string)
- func LogDebug(s string)
- func LogDebugError(e error)
- func LogError(e error)
- func LogWarning(s string)
- func MapToDotNETJSONFormat(secrets map[string]string) map[string]string
- func MapToEnvFormat(secrets map[string]string, wrapInQuotes bool) []string
- func Max[T constraints.Ordered](x, y T) T
- func Min[T constraints.Ordered](x, y T) T
- func ParseEnvStrings(envStrings []string) map[string]string
- func ParsePath(path string) (string, error)
- func Print(info string)
- func PrintWarning(s string)
- func RandomBase64String(l int) string
- func RedactAuthToken(token string) string
- func RequireValue(name string, value string)
- func RestrictedFilePerms() os.FileMode
- func Retry(attempts int, sleep time.Duration, f func() error) error
- func RunCommand(command []string, env []string, inFile io.Reader, outFile io.Writer, ...) (*exec.Cmd, error)
- func RunCommandString(command string, env []string, inFile io.Reader, outFile io.Writer, ...) (*exec.Cmd, error)
- func SelectPrompt(message string, options []string, defaultOption string) string
- func UUID() (string, error)
- func UpperCamel(name string) string
- func WaitCommand(cmd *exec.Cmd) (int, error)
- func WriteFile(filename string, data []byte, perm os.FileMode) error
- func WriteTempFile(name string, data []byte, perm os.FileMode) (string, error)
- type StopRetry
Constants ¶
const SupportsNamedPipes = true
Variables ¶
var Debug = false
Debug whether we're running in debug mode
var DebugTUI = false
DebugTUI whether to log TUI debug messages to $config_dir/tui.log
var OutputJSON = false
OutputJSON whether to print OutputJSON
var Silent = false
Silent whether we should display Info messages
Functions ¶
func Clamp ¶
func Clamp[T constraints.Ordered](x, min, max T) T
func ConfirmationPrompt ¶
ConfirmationPrompt prompt user to confirm yes/no
func Contains ¶
func Contains[T comparable](s []T, e T) bool
func CopyToClipboard ¶
CopyToClipboard copies text to the user's clipboard
func CreateNamedPipe ¶
func DotNETNameTransform ¶
func FilterMap ¶
FilterMap returns a new map[string]T containing origMap keys that match aginst the keysToSelect if a key in keysToSelect is not present in origMap it will be silently ignored
func GetBoolFlag ¶
GetBoolFlag gets the flag's boolean value
func GetBoolFlagIfChanged ¶
GetBoolFlagIfChanged gets the flag's boolean value, if specified; protects against reading an undefined flag
func GetDurationFlag ¶
GetDurationFlag gets the flag's duration
func GetDurationFlagIfChanged ¶
GetDurationFlagIfChanged gets the flag's duration, if specified; protects against reading an undefined flag
func GetFilePath ¶
GetFilePath verify a file path and name are provided
func GetFlagIfChanged ¶
GetFlagIfChanged gets the flag's value, if specified; protects against reading an undefined flag
func GetIntFlag ¶
GetIntFlag gets the flag's int value
func GetPathFlagIfChanged ¶
GetPathFlagIfChanged gets the flag's path, if specified; always returns an absolute path
func HandleError ¶
HandleError prints the error and exits with code 1
func HasDataOnStdIn ¶
func IsDotNETSettingsFile ¶
func IsMINGW64 ¶
func IsMINGW64() bool
IsMINGW64 whether the host os is running in a MINGW64-based environment like Git Bash, Cygwin, etc.
func IsProcessRunning ¶
func IsValidUUID ¶
func LogDebugError ¶
func LogDebugError(e error)
LogDebugError prints an error message to stderr when in debug mode
func MapToDotNETJSONFormat ¶
func Max ¶
func Max[T constraints.Ordered](x, y T) T
func Min ¶
func Min[T constraints.Ordered](x, y T) T
func ParseEnvStrings ¶
ParseEnvStrings returns a new map[string]string created by parsing env strings (in `key=value` format).
func RandomBase64String ¶
RandomBase64String cryptographically secure random string from https://stackoverflow.com/questions/22892120/how-to-generate-a-random-string-of-a-fixed-length-in-go
func RedactAuthToken ¶
RedactAuthToken returns a partially-redacted value that's safe for display
func RequireValue ¶
RequireValue throws an error if a value is blank
func RestrictedFilePerms ¶
RestrictedFilePerms perms used for creating restrictied files meant to be accessible only to the user
func RunCommand ¶
func RunCommand(command []string, env []string, inFile io.Reader, outFile io.Writer, errFile io.Writer, forwardSignals bool) (*exec.Cmd, error)
RunCommand runs the specified command
func RunCommandString ¶
func RunCommandString(command string, env []string, inFile io.Reader, outFile io.Writer, errFile io.Writer, forwardSignals bool) (*exec.Cmd, error)
RunCommandString runs the specified command string
func SelectPrompt ¶
SelectPrompt prompt user to select from a list of options