0001 // 0002 // ArgumentType.swift 0003 // Commandant 0004 // 0005 // Created by Syo Ikeda on 12/14/15. 0006 // Copyright (c) 2015 Carthage. All rights reserved. 0007 // 0008 0009 /// Represents a value that can be converted from a command-line argument. 0010 public protocol ArgumentType{ 0011 /// A human-readable name for this type. 0012 static var name
Argument.swift:38 public func <| <T: ArgumentType, ClientError>(mode: CommandMode, argument: Argument<T>) -> Result<T, CommandantError<ClientError>> {Argument.swift:64 public func <| <T: ArgumentType, ClientError>(mode: CommandMode, argument: Argument<[T]>) -> Result<[T], CommandantError<ClientError>> {ArgumentType.swift:18 extension Int: ArgumentType {ArgumentType.swift:26 extension String: ArgumentType {Errors.swift:87 internal func informativeUsageError<T: ArgumentType, ClientError>(argument: Argument<T>) -> CommandantError<ClientError> {Errors.swift:105 internal func informativeUsageError<T: ArgumentType, ClientError>(argument: Argument<[T]>) -> CommandantError<ClientError> {Errors.swift:135 internal func informativeUsageError<T: ArgumentType, ClientError>(option: Option<T>) -> CommandantError<ClientError> {Option.swift:163 public func <| <T: ArgumentType, ClientError>(mode: CommandMode, option: Option<T>) -> Result<T, CommandantError<ClientError>> {: String { get } 0013 0014 /// Attempts to parse a value from the given command-line argument. 0015 static func fromString(string: String) -> Self? 0016 } 0017 0018 extension Int: ArgumentType { 0019 public static let name = "integer" 0020 0021 public static func fromString(string: String) -> Int? { 0022 return Int(string) 0023 } 0024 } 0025 0026 extension String: ArgumentType { 0027 public static let name = "string" 0028 0029 public static func fromString(string: String) -> String? { 0030 return string 0031 } 0032 } 0033
Errors.swift:96 example += "(\(T.name))"Errors.swift:114 example += "(\(T.name))"Errors.swift:144 example += "(\(T.name))"