Skip to content

Commit

Permalink
Merge pull request #94 from interstateone/swift-argument-parser
Browse files Browse the repository at this point in the history
Replace Guaka with swift-argument-parser
  • Loading branch information
Brandon Evans authored Jan 8, 2021
2 parents 5faa05a + 1095221 commit 286b5b2
Show file tree
Hide file tree
Showing 5 changed files with 357 additions and 260 deletions.
37 changes: 14 additions & 23 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -6,62 +6,53 @@
"repositoryURL": "https://github.com/PromiseKit/Foundation.git",
"state": {
"branch": null,
"revision": "0a59b0d89f469979aecacdf9046df14f99d1cc6b",
"version": "3.3.2"
}
},
{
"package": "Guaka",
"repositoryURL": "https://github.com/nsomar/Guaka.git",
"state": {
"branch": null,
"revision": "6fb29b2378166a30d72120980e1c099c664598de",
"version": "0.4.1"
"revision": "1a276e598dac59489ed904887e0740fa75e571e0",
"version": "3.3.4"
}
},
{
"package": "KeychainAccess",
"repositoryURL": "https://github.com/kishikawakatsumi/KeychainAccess.git",
"state": {
"branch": null,
"revision": "0046db4ab8fd7be31a59e57912dbb96639ad8ce9",
"version": "3.2.0"
"revision": "8d33ffd6f74b3bcfc99af759d4204c6395a3f918",
"version": "3.2.1"
}
},
{
"package": "LegibleError",
"repositoryURL": "https://github.com/mxcl/LegibleError.git",
"state": {
"branch": null,
"revision": "c615c01e461e8a3495ba4ea75f5d671c76820105",
"version": "1.0.1"
"revision": "909e9bab3ded97350b28a5ab41dd745dd8aa9710",
"version": "1.0.4"
}
},
{
"package": "Path.swift",
"repositoryURL": "https://github.com/mxcl/Path.swift.git",
"state": {
"branch": null,
"revision": "f324b4a562ca421fd2905414a10fb0fc91d58b67",
"version": "0.16.2"
"revision": "dac007e907a4f4c565cfdc55a9ce148a761a11d5",
"version": "0.16.3"
}
},
{
"package": "PromiseKit",
"repositoryURL": "https://github.com/mxcl/PromiseKit.git",
"state": {
"branch": null,
"revision": "fe1e9c5b62465227cceb7b0e6e79489ba7b824af",
"version": "6.8.4"
"revision": "1c296a8637838901d2b01e4c46875ee749506133",
"version": "6.8.5"
}
},
{
"package": "StringScanner",
"repositoryURL": "https://github.com/getGuaka/StringScanner.git",
"package": "swift-argument-parser",
"repositoryURL": "https://github.com/apple/swift-argument-parser",
"state": {
"branch": null,
"revision": "de1685ad202cb586d626ed52d6de904dd34189f3",
"version": "0.4.1"
"revision": "92646c0cdbaca076c8d3d0207891785b3379cbff",
"version": "0.3.1"
}
},
{
Expand Down
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ let package = Package(
.library(name: "AppleAPI", targets: ["AppleAPI"]),
],
dependencies: [
.package(url: "https://github.com/nsomar/Guaka.git", .upToNextMinor(from: "0.4.0")),
.package(url: "https://github.com/apple/swift-argument-parser", .upToNextMinor(from: "0.3.0")),
.package(url: "https://github.com/mxcl/Path.swift.git", .upToNextMinor(from: "0.16.0")),
.package(url: "https://github.com/mxcl/Version.git", .upToNextMinor(from: "1.0.3")),
.package(url: "https://github.com/mxcl/PromiseKit.git", .upToNextMinor(from: "6.8.3")),
Expand All @@ -25,7 +25,7 @@ let package = Package(
.target(
name: "xcodes",
dependencies: [
"Guaka", "XcodesKit"
.product(name: "ArgumentParser", package: "swift-argument-parser"), "XcodesKit"
]),
.testTarget(
name: "xcodesTests",
Expand Down
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,21 @@ Xcode will be installed to /Applications by default, but you can provide the pat
- `update`: Update the list of available versions of Xcode
- `version`: Print the version number of xcodes itself

### Shell Completion Scripts

xcodes can generate completion scripts which allow you to press the tab key on your keyboard to autocomplete commands and arguments when typing an xcodes command. The steps to install a completion script depend on the shell that you use. More information about installation instructions for different shells and the underlying implementation is available in the [swift-argument-parser repo](https://github.com/apple/swift-argument-parser/blob/master/Documentation/07%20Completion%20Scripts.md).

<details>
<summary>Zsh, with oh-my-zsh:</summary>

Run the following commands:

```sh
mkdir ~/.oh-my-zsh/completions
xcodes --generate-completion-script > ~/.oh-my-zsh/completions/_xcodes
```
</details>

## Development

You'll need Xcode 12 in order to build and run xcodes.
Expand Down
10 changes: 10 additions & 0 deletions Sources/xcodes/ParsableArguments+LegibleError.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import ArgumentParser
import LegibleError
import XcodesKit

extension ParsableArguments {
static func exit(withLegibleError error: Error) -> Never {
Current.logging.log(error.legibleLocalizedDescription)
Self.exit(withError: ExitCode.failure)
}
}
Loading

0 comments on commit 286b5b2

Please sign in to comment.