Classes
The following classes are available globally.
-
Command class representing a Command that can be executed.
Examples:
Create a simple command
var newCommand = Command(usage: "new") { flags, args in }
Create a command with costumizations
var newCommand = Command(usage: "new", shortMessage: "Use new to generate a new thing", longMessage: "Long description", example: "Example", aliases: ["create", "generate"]) { flags, args in }
Create a command with configuration block and an execute block
var rootCommand = Command( usage: "test", configuration: configuration, run: execute) private func configuration(command: Command) { command.add(flags: [ // Add your flags here ] ) // Other configurations } private func execute(flags: Flags, args: [String]) { // Execute code here print("test called") }
After creating a command, to execute it do:
See morelet command = ... command.execute()
Declaration
Swift
public class Command