 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Overview ¶
Package console contains helper functions for ending a program with a specific exit code and message.
Index ¶
- func Fatal(exitCode int, v ...interface{})
- func Fatalf(exitCode int, format string, v ...interface{})
- func ReadDirectoryFlagValue(flagName string, flagValue *string, isRequired bool, onErrorExitCode int) string
- func ReadFileFlagValue(flagName string, flagValue *string, isRequired bool, onErrorExitCode int) string
- func ReadRequiredFlagBaseURLValue(flagName string, flagValue *string, onErrorExitCode int) url.URL
- func ReadRequiredFlagBoolValue(flagName string, flagValue *bool, onErrorExitCode int) bool
- func ReadRequiredFlagNonNegativeIntValue(flagName string, flagValue *int, onErrorExitCode int) int
- func ReadRequiredFlagStringValue(flagName string, flagValue *string, onErrorExitCode int) string
- func ReadStringCollectionValue(flagValue *string) []string
- func ReadStringCollectionWithSeparatorValue(flagValue *string, sep string) []string
- func ReadTextFileFlagValue(flagName string, flagValue *string, isRequired bool, onErrorExitCode int) string
- func SetLogger(flagName string, flagValue *string, teeToStdout bool, onErrorExitCode int) *os.File
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Fatal ¶
func Fatal(exitCode int, v ...interface{})
Fatal terminates a program with a specific exit code and zero or more messages.
func Fatalf ¶
Fatalf terminates a program with a specific exit code and zero or more messages formatted using a format string that's sent to the log and stderr.
func ReadDirectoryFlagValue ¶
func ReadDirectoryFlagValue(flagName string, flagValue *string, isRequired bool, onErrorExitCode int) string
ReadDirectoryFlagValue tests whether the specified string refers to a directory. It ends the program with the specified exit code if an error occurs or if the required directory flag value does not refer to a directory.
func ReadFileFlagValue ¶
func ReadFileFlagValue(flagName string, flagValue *string, isRequired bool, onErrorExitCode int) string
ReadFileFlagValue tests whether the specified string refers to a file. It ends the program with the specified exit code if an error occurs or if the required file flag value does not refer to a file.
func ReadRequiredFlagBaseURLValue ¶
ReadRequiredFlagBaseURLValue returns the value of a required base URL flag. It returns the flag value for the specified flag and ends the program with the specified exit code if the flag value is not a valid URL.
func ReadRequiredFlagBoolValue ¶
ReadRequiredFlagBoolValue returns the value of a required bool flag. It returns the flag value for the specified flag and ends the program with the specified exit code if the flag value is missing.
func ReadRequiredFlagNonNegativeIntValue ¶
ReadRequiredFlagNonNegativeIntValue returns the value of a required int flag. It returns the flag value for the specified flag and ends the program with the specified exit code if the flag value is negative.
func ReadRequiredFlagStringValue ¶
ReadRequiredFlagStringValue returns the value of a required string flag. It returns the flag value for the specified flag and ends the program with the specified exit code if the flag value is not present.
func ReadStringCollectionValue ¶
ReadStringCollectionValue returns the value of a string collection flag. It returns the collection of values expressed with a semicolon separator character.
func ReadStringCollectionWithSeparatorValue ¶
ReadStringCollectionWithSeparatorValue returns the value of a string collection flag. It returns the collection of values expressed using the specified separator character.
func ReadTextFileFlagValue ¶
func ReadTextFileFlagValue(flagName string, flagValue *string, isRequired bool, onErrorExitCode int) string
ReadTextFileFlagValue returns the string in the specified file flag value. It returns the file contents as a trimmed string value and ends the program with the specified exit code if an error occurs.
Types ¶
This section is empty.