Add command to generate Colors
This commit is contained in:
@ -1,26 +0,0 @@
|
||||
//
|
||||
// File.swift
|
||||
//
|
||||
//
|
||||
// Created by Thibaut Schmitt on 13/12/2021.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
extension String {
|
||||
func removeCharacters(from forbiddenChars: CharacterSet) -> String {
|
||||
let passed = self.unicodeScalars.filter { !forbiddenChars.contains($0) }
|
||||
return String(String.UnicodeScalarView(passed))
|
||||
}
|
||||
|
||||
func removeCharacters(from: String) -> String {
|
||||
return removeCharacters(from: CharacterSet(charactersIn: from))
|
||||
}
|
||||
}
|
||||
|
||||
extension Sequence where Iterator.Element: Hashable {
|
||||
func unique() -> [Iterator.Element] {
|
||||
var seen: [Iterator.Element: Bool] = [:]
|
||||
return self.filter { seen.updateValue(true, forKey: $0) == nil }
|
||||
}
|
||||
}
|
@ -16,12 +16,16 @@ enum FontToolError: Error {
|
||||
switch self {
|
||||
case .fcScan(let path, let code, let output):
|
||||
return """
|
||||
[FontTool]
|
||||
Error while getting fontName (fc-scan --format %{postscriptname} \(path).
|
||||
fc-scan exit with \(code) and output is: \(output ?? "no output")
|
||||
"""
|
||||
|
||||
case .inputFolderNotFound(let inputFolder):
|
||||
return "Input folder not found: \(inputFolder)"
|
||||
return """
|
||||
[ColorTool]
|
||||
Input folder not found: \(inputFolder)
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,11 @@ import Foundation
|
||||
import CLIToolCore
|
||||
import ArgumentParser
|
||||
|
||||
/*
|
||||
Lire l'infoPlist et check si les fonts dedans sont les memes que celles à générer
|
||||
*/
|
||||
|
||||
//swift run -c release FontToolCore ./SampleFiles/Fonts --extension-output-path ~/Desktop --extension-name R2Font
|
||||
struct FontTool: ParsableCommand {
|
||||
static let defaultExtensionName = "UIFont"
|
||||
|
||||
@ -22,7 +27,7 @@ struct FontTool: ParsableCommand {
|
||||
var extensionName: String = Self.defaultExtensionName
|
||||
|
||||
public func run() throws {
|
||||
print("[FontTool] Starting font generation")
|
||||
print("[FontTool] Starting fonts generation")
|
||||
|
||||
let fontsData = FontToolHelper.getFontsData(fromInputFolder: inputFolder)
|
||||
|
||||
@ -41,7 +46,7 @@ struct FontTool: ParsableCommand {
|
||||
print("Info.plist information:")
|
||||
print("\(generatePlistUIAppFonts(fontsNames: fontsData.fontsNames))")
|
||||
|
||||
print("[FontTool] Font generated")
|
||||
print("[FontTool] Fonts generated")
|
||||
}
|
||||
|
||||
private func generateExtensionFile(_ args: String...) {
|
||||
|
Reference in New Issue
Block a user