18 lines
470 B
Swift
Executable File
18 lines
470 B
Swift
Executable File
import Foundation
|
|
import Cocoa
|
|
|
|
let cmd = (CommandLine.arguments[0] as NSString).lastPathComponent
|
|
|
|
if CommandLine.arguments.count < 3 {
|
|
fputs("usage: \(cmd) LABEL URL\n", stderr)
|
|
exit(1)
|
|
}
|
|
|
|
let label = CommandLine.arguments[1]
|
|
let url = CommandLine.arguments[2]
|
|
|
|
let pasteBoard = NSPasteboard.general
|
|
pasteBoard.clearContents()
|
|
pasteBoard.setString("[\(label)](\(url))", forType: .string)
|
|
pasteBoard.setString("<a href=\"\(url)\">\(label)</a>", forType: .html)
|