diff --git a/Sources/swcomp/Archives/BZip2Command.swift b/Sources/swcomp/Archives/BZip2Command.swift index de2945c5..18bbfd2f 100644 --- a/Sources/swcomp/Archives/BZip2Command.swift +++ b/Sources/swcomp/Archives/BZip2Command.swift @@ -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" diff --git a/Sources/swcomp/Extensions/BlockSize+ConvertibleFromString.swift b/Sources/swcomp/Extensions/BlockSize+ConvertibleFromString.swift deleted file mode 100644 index 1a4a51fa..00000000 --- a/Sources/swcomp/Extensions/BlockSize+ConvertibleFromString.swift +++ /dev/null @@ -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) - } - -}