Skip to content

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

Instance Properties

Relationships

Conforms To

  • Swift.Sendable
  • Swift.SendableMetatype