Skip to content

Commit 1f184ae

Browse files
committed
[Main run] Support handling version
1 parent c1e70b7 commit 1f184ae

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Commander/CommandType.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,16 @@ extension CommandType {
1212
}
1313

1414
/// Run the command using the `Process.argument`, removing the executable name
15-
@noreturn public func run() {
15+
@noreturn public func run(version:String? = nil) {
1616
let parser = ArgumentParser(arguments: Process.arguments)
17+
18+
if parser.hasOption("version") {
19+
if let version = version {
20+
print(version)
21+
exit(0)
22+
}
23+
}
24+
1725
parser.shift() // Executable Name
1826

1927
do {

0 commit comments

Comments
 (0)