refactor CLI

This commit is contained in:
2026-07-13 11:43:37 +02:00
parent 909d890837
commit 1a2eddcd5d
7 changed files with 19 additions and 19 deletions
@@ -19,7 +19,7 @@ extension PHBlock {
let setFile = base.appending(path: "blocks").appending(path: "\(blocks).toml")
guard FileManager.default.fileExists(atPath: setFile.relativePath) else {
throw phbar.Error("Failed to load blocks '\(blocks)'")
throw PHBar.Error("Failed to load blocks '\(blocks)'")
}
return try load(from: setFile)
}
@@ -30,11 +30,11 @@ extension PHBlock {
do {
let data = try Data(contentsOf: url)
guard let contents = String(data: data, encoding: .utf8), !contents.isEmpty else {
throw phbar.Error("the file is empty")
throw PHBar.Error("the file is empty")
}
return try load(from: contents)
} catch {
throw phbar.Error("Failed to load blocks file", underlyingError: error)
throw PHBar.Error("Failed to load blocks file", underlyingError: error)
}
}
@@ -46,7 +46,7 @@ extension PHBlock {
let wrapper = try decoder.decode(PHBlock.Wrapper.self, from: contents)
return wrapper.blocks
} catch {
throw phbar.Error("Failed to parse blocks file", underlyingError: error)
throw PHBar.Error("Failed to parse blocks file", underlyingError: error)
}
}
}