nikstar/clinterface
> __This project is archived.__ I'm happy with how __CLInterface__ turned out; it's architecture includes extensive use of reflection to achieve exactly the API I wanted. Unfortunatly, soon after it's release, Apple came out with its own first-party [argument parser library](http
Example
final class Swiftc : CLInterface {
var description = "Swift compiler"
@Argument("--output", "-o", usage: "Write output to <file>")
var outputPath: String?
@Argument("-g", usage: "Emit debug info", default: false)
var debugMode: Bool
@PositionalArgument(name: "files", usage: "Files that will be compiled")
var files: [String]
}After calling parseArguments, you will be able to use these properties like normal variables.
let swiftc = Swiftc()
try swiftc.parseArguments(["-o", "hello", "-g", "main.swift", "Greeter.swift"])
swiftc.outputPath // Optional("hello")
swiftc.debugMode // true
swiftc.files // ["main.swift", "Greeter.swift"]swiftc -h or swiftc --help prints usage info:
OVERVIEW: Swift compiler
OPTIONS:
--output, -o Write output to <file>
-g Emit debug info
--help Display available options
POSITIONAL ARGUMENTS:
files Files that will be compiledSee ExampleSwiftc for working example.
See Opusab, my audiobook converter, for another real-life example.
Package Metadata
Repository: nikstar/clinterface
Default branch: master
README: README.md