mirror of
https://github.com/tsolomko/SWCompression.git
synced 2026-06-23 14:56:41 +00:00
[swcomp] Replace ConvertibleFromString extension for BZip2.BlockSize with an empty conformance
SwiftCLI provides a default implementation for enums with Int raw values.
This commit is contained in:
@@ -7,6 +7,11 @@ import Foundation
|
||||
import SWCompression
|
||||
import SwiftCLI
|
||||
|
||||
// This extension allows to use BZip2.BlockSize as a Key option.
|
||||
// The extension is empty because there is a default implementation for a ConvertibleFromString when the RawValue type
|
||||
// of the enum (Int, in this case) is ConvertibleFromString itself.
|
||||
extension BZip2.BlockSize: ConvertibleFromString {}
|
||||
|
||||
class BZip2Command: Command {
|
||||
|
||||
let name = "bz2"
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
// Copyright (c) 2021 Timofey Solomko
|
||||
// Licensed under MIT License
|
||||
//
|
||||
// See LICENSE for license information
|
||||
|
||||
import Foundation
|
||||
import SwiftCLI
|
||||
import SWCompression
|
||||
|
||||
/// This extension allows to use `BlockSize` as a `Key` option.
|
||||
extension BZip2.BlockSize: ConvertibleFromString {
|
||||
|
||||
public static func convert(from: String) -> BZip2.BlockSize? {
|
||||
guard let num = Int(from)
|
||||
else { return nil }
|
||||
return BZip2.BlockSize(rawValue: num)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user