Skip to content

Commit ed385ee

Browse files
authored
Print API key instructions (#9)
* Remove unused argument * Print instructions for obtaining API key
1 parent 4263447 commit ed385ee

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

Sources/ImageCramCLI/ApiKeyRepository.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,13 @@ struct ApiKeyRepository {
3333
}
3434

3535
private func readNewKey() throws -> String {
36-
printer.forcedOutput(message: "Please enter your TinyPNG API key. More details at https://tinypng.com/developers")
36+
let instructions = """
37+
Please enter your TinyPNG API key.
38+
If you already have a TinyPNG account, you can get the API key from: https://tinypng.com/dashboard/api.
39+
Otherwise, you can find more details at https://tinypng.com/developers.
40+
"""
41+
printer.forcedOutput(message: instructions)
42+
3743
let newKey = readLine()?.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
3844
if !newKey.isEmpty {
3945
try write(apiKey: newKey)

Sources/ImageCramCLI/FileMover.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import Files
44
import Foundation
55

66
struct FileMover {
7-
let printer: CommandLinePrinter
87
let outputPath: String?
98

109
func move(inputPath: String, from localUrl: URL) throws {

Sources/ImageCramCLI/ImageCramCommand.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ struct ImageCramCommand: ParsableCommand {
5252
}
5353

5454
let compressor = ImageCompressor(apiKey: apiKey, printer: printer)
55-
let mover = FileMover(printer: printer, outputPath: output)
55+
let mover = FileMover(outputPath: output)
5656

5757
for input in inputs {
5858
let result = try compressor.compress(filePath: input)

0 commit comments

Comments
 (0)