Class
Argument
An argument for a console command
@propertyWrapper final class Argument<Value> where Value : LosslessStringConvertible, Value : Sendable
Overview
exec command <arg>
Used by the Command.Arguments associated type:
struct CowsayCommand: Command {
struct Arguments {
let message = Argument<String>(name: "message")
}
// ...
}
Fetch arguments using CommandContext<Command>.argument(_:):
struct CowsayCommand: Command {
// ...
func run(using context: CommandContext<CowsayCommand>) throws -> Future<Void> {
let message = try context.argument(\.message)
// ...
}
// ...
}
See Command for more information.
Topics
Initializers
init(name: String, help: String, completion: CompletionAction)Creates a newArgument
Instance Properties
let completion: CompletionActionThe argument’s shell completion action.let help: StringThe argument’s help text when--helpis passed in.var initialized: Boollet name: StringThe argument’s identifying name.var projectedValue: Argument<Value>var wrappedValue: Value
Relationships
Conforms To
Swift.SendableSwift.SendableMetatype