Skip to content

Commit

Permalink
命令行参数
Browse files Browse the repository at this point in the history
  • Loading branch information
L-Zephyr committed May 23, 2018
1 parent 45ad660 commit b83357a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<key>PathKitPackageDescription.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>3</integer>
<integer>2</integer>
</dict>
<key>drafter.xcscheme</key>
<dict>
Expand All @@ -37,7 +37,7 @@
<key>drafterPackageDescription.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>2</integer>
<integer>3</integer>
</dict>
<key>drafterPackageTests.xcscheme</key>
<dict>
Expand Down
4 changes: 3 additions & 1 deletion Sources/Drafter/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ enum DraftOutputType: String {
}

// 命令行参数解析
let filePath = StringOption("f", "file", true, "The file or directory to be parsed, supported: .h and .m. Multiple arguments are separated by commas.")
let filePath = StringOption("f", "file", false, "The file or directory to be parsed, supported: .h and .m. Multiple arguments are separated by commas.")

let output = EnumOption<DraftOutputType>(shortFlag: "t", longFlag: "type", required: false, helpMessage: "The output type. Choose 'html' to generate a html page, choose 'png' to generate a picture. Defaults to 'html'")

Expand Down Expand Up @@ -52,6 +52,8 @@ if version.value {

// 必须指定文件路径
guard let paths = filePath.value else {
print("Error: File path was missing!")
cli.printUsage()
exit(EX_USAGE)
}

Expand Down

0 comments on commit b83357a

Please sign in to comment.