From a852495c71f4761d855163d605a6252131910bc5 Mon Sep 17 00:00:00 2001 From: Marcus Wu Date: Mon, 7 May 2018 10:45:11 +0800 Subject: [PATCH] Implement given type to sort, support .h and .m now --- Sources/ObjcImportSorter/main.swift | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Sources/ObjcImportSorter/main.swift b/Sources/ObjcImportSorter/main.swift index 34978dc..7c049df 100644 --- a/Sources/ObjcImportSorter/main.swift +++ b/Sources/ObjcImportSorter/main.swift @@ -1,10 +1,16 @@ import Commander import ObjcImportSorterCore +import Rainbow Group { - $0.command("sort") { - ImportSorter().sort(by: .h) + $0.command("sort") { (fileType: String) in + guard let fileType = FileType(rawValue: "*." + fileType) else { + print("Wrong given type".red) + return + } + + ImportSorter().sort(by: fileType) } }.run()