Enumerations

The following enumerations are available globally.

  • Deprecation status type for flags and commands

    • notDeprecated: not deprecated, this is the default
    • deprecated: the flag/command is deprecated
    See more

    Declaration

    Swift

    public enum DeprecationStatus
  • Command Error Enum

    • wrongFlagPattern: Received a wrong flag patter, such as ---f
    • flagNeedsValue: Flag requires a value that was not set
    • flagNotFound: Flag with name cannot be found
    • requiredFlagsWasNotSet: Required flag was not set
    • unexpectedFlagPassed: Parsed an unexpected flag name
    • commandGeneralError: General command related error
    • unknownError: Unknown error occured
    • incorrectFlagValue: An incorrect value type was passed to the flag
    • wrongCommandUsageString: Wrong usage string was passed to the command
    • wrongFlagLongName: Wrong long name was passed for flag
    • wrongFlagShortName: Wrong long name was passed for flag
    See more

    Declaration

    Swift

    public enum CommandError : Error
  • Error to throw when converting string to FlagValue

    • conversionError: conversation error string This string will be used to be printed to the console

    Example

    struct User: FlagValue {
      let name: String
    
      static func fromString(flagValue value: String) throws -> User {
        if value == "wrong" {
            throw FlagValueError.conversionError("wrong user passed")
        }
        return User(name: value)
      }
    
      static var typeDescription: String {
        return "A user structure"
      }
    }
    
    See more

    Declaration

    Swift

    public enum FlagValueError : Error