[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:
Timofey Solomko
2021-10-25 20:00:22 +03:00
parent 68fd0e8f49
commit 01c106228b
2 changed files with 5 additions and 19 deletions
@@ -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)
}
}