Skip to content
This repository was archived by the owner on Jul 28, 2021. It is now read-only.

Commit c46dc64

Browse files
author
Christian Elies
committed
chore(): swift 5.1, added platform to Package.swift; docs(readme): added spm installation section; feat(): made sdoutStream and stderrStream public; refactor(): fixed hashable conformance
1 parent 2d34b23 commit c46dc64

File tree

5 files changed

+22
-13
lines changed

5 files changed

+22
-13
lines changed

ArgumentParserKit.podspec

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,13 @@
22
# Be sure to run `pod lib lint ArgumentParserKit.podspec' to ensure this is a
33
# valid spec before submitting.
44
#
5-
# Any lines starting with a # are optional, but their use is encouraged
6-
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
7-
#
8-
95
Pod::Spec.new do |s|
106
s.name = 'ArgumentParserKit'
117
s.version = '1.0.0'
128
s.summary = 'Type-safe and easy way for parsing command line arguments in your macOS command line tools.'
139

1410
s.description = <<-DESC
15-
I think the ArgumentParser Apple hides inside their Swift Package Manager deserves more. That's why I extracted the relevant source code into a Pod to make it available to a larger audience.
11+
I think the ArgumentParser Apple hides inside their Swift Package Manager deserves more. That's why I extracted the relevant source code into a Pod / Swift package to make it available to a larger audience.
1612
The ArgumentParser offers a type-safe and easy way to parse arguments given via the command line to your program. Keep in mind that Apple itself makes clear that you use this private and maybe unstable API at your own risk.
1713
DESC
1814

@@ -22,7 +18,7 @@ Pod::Spec.new do |s|
2218
s.source = { :git => 'https://github.com/crelies/ArgumentParserKit.git', :tag => s.version.to_s }
2319

2420
s.cocoapods_version = '>= 1.4'
25-
s.swift_version = '4.0'
21+
s.swift_version = '5.1'
2622
s.platform = :osx
2723
s.osx.deployment_target = "10.10"
2824

ArgumentParserKit/Classes/ArgumentParser.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,8 @@ protocol ArgumentProtocol: Hashable {
287287
extension ArgumentProtocol {
288288
// MARK: - Conformance for Hashable
289289

290-
public var hashValue: Int {
291-
return name.hashValue
290+
public func hash(into hasher: inout Hasher) {
291+
hasher.combine(name)
292292
}
293293

294294
public static func == (_ lhs: Self, _ rhs: Self) -> Bool {

ArgumentParserKit/Classes/OutputByteStream.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ final class BufferedOutputByteStream: OutputByteStream {
611611
}
612612

613613
/// Represents a stream which is backed to a file. Not for instantiating.
614-
class FileOutputByteStream: OutputByteStream {
614+
public class FileOutputByteStream: OutputByteStream {
615615

616616
/// Closes the file flushing any buffered data.
617617
final func close() throws {
@@ -704,11 +704,11 @@ final class LocalFileOutputByteStream: FileOutputByteStream {
704704
}
705705

706706
/// stdout stream instance.
707-
var stdoutStream: FileOutputByteStream = try! LocalFileOutputByteStream(
707+
public let stdoutStream: FileOutputByteStream = try! LocalFileOutputByteStream(
708708
filePointer: stdout,
709709
closeOnDeinit: false)
710710

711711
/// stderr stream instance.
712-
var stderrStream: FileOutputByteStream = try! LocalFileOutputByteStream(
712+
public let stderrStream: FileOutputByteStream = try! LocalFileOutputByteStream(
713713
filePointer: stderr,
714714
closeOnDeinit: false)

Package.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import PackageDescription
44

55
let package = Package(
66
name: "ArgumentParserKit",
7+
platforms: [
8+
.macOS(.v10_10)
9+
],
710
products: [
811
.library(
912
name: "ArgumentParserKit",

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Type-safe and easy way for parsing command line arguments in your macOS command line tools
44

55
[![Version](https://img.shields.io/cocoapods/v/ArgumentParserKit.svg?longCache=true&style=flat-square)](http://cocoapods.org/pods/ArgumentParserKit)
6-
[![Swift4](https://img.shields.io/badge/swift4-compatible-orange.svg?longCache=true&style=flat-square)](https://developer.apple.com/swift)
6+
[![Swift5.1](https://img.shields.io/badge/swift5.1-compatible-orange.svg?longCache=true&style=flat-square)](https://developer.apple.com/swift)
77
[![Platform](https://img.shields.io/badge/platform-macOS-lightgrey.svg?longCache=true&style=flat-square)](https://www.apple.com/de/macos)
88
[![License](https://img.shields.io/badge/license-Apache%20License%20v2.0-lightgrey.svg?longCache=true&style=flat-square)](https://en.wikipedia.org/wiki/Apache_License)
99

@@ -102,17 +102,27 @@ func get<T>(_ argument: OptionArgument<T>) -> T?
102102

103103
## Requirements
104104

105-
Deployment target has to be greater than or equal to 10.10.
105+
Deployment target has to be greater than or equal to macOS 10.10.
106106

107107
## Installation
108108

109+
### Cocoapods
110+
109111
ArgumentParserKit is available through [CocoaPods](https://cocoapods.org). To install
110112
it, simply add the following line to your Podfile:
111113

112114
```ruby
113115
pod 'ArgumentParserKit'
114116
```
115117

118+
### Swift package manager
119+
120+
Add this **Swift package** as a dependency to your *Package.swift*
121+
122+
```swift
123+
.package(url: "https://github.com/crelies/ArgumentParserKit.git", from: "1.0.0")
124+
```
125+
116126
## Further resources
117127

118128
Take a look at [Parsing Command Line Arguments using the internal `ArgumentParser` inside of the `Swift Package Manager`](https://www.enekoalonso.com/articles/parsing-command-line-arguments-with-swift-package-manager-argument-parser)

0 commit comments

Comments
 (0)