Skip to content
This repository has been archived by the owner on Nov 14, 2020. It is now read-only.

Commit

Permalink
Added version option
Browse files Browse the repository at this point in the history
  • Loading branch information
acecilia committed May 13, 2019
1 parent 1e4fe3b commit 1a9e22d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Sources/specgen/CommandLineParsing/Bootstrap/RootParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ import SPMUtility

class RootParser {
let argumentParser: ArgumentParser
let printVersion: OptionArgument<Bool>

init() {
argumentParser = ArgumentParser(
usage: "<subcommand> <options>\nRun '\(ProcessInfo.processInfo.processName) <subcommand> --help' for information about each subcommand",
overview: "A command line tool for generating podspec files from frameworks, so they can be used in a CocoaPods setup"
)
printVersion = argumentParser.add(option: "--version", shortName: "-v", kind: Bool.self, usage: "Prints the version", completion: nil)
}
}
5 changes: 5 additions & 0 deletions Sources/specgen/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ do {

// If execution got to this point, means that the provided arguments are correct

if commandLineArguments.get(rootParser.printVersion) == true {
print(version)
exit(0)
}

switch try Command(rootParser.argumentParser, commandLineArguments) {
case .bootstrap:
let boostrapArgs = BootstrapArguments(commandLineArguments, parser: bootstrapSubparser)
Expand Down

0 comments on commit 1a9e22d

Please sign in to comment.