Take notes on the command line: Difference between revisions

m
(add swift)
Line 1,663:
<lang Swift>import Foundation
 
let args = Process.arguments
let manager = NSFileManager()
let currentPath = manager.currentDirectoryPath
Line 1,677 ⟶ 1,678:
 
// Print the file if there are no args
if C_ARGCargs.count == 1 {
let str = NSString(contentsOfFile: currentPath + "/notes.txt", encoding: NSUTF8StringEncoding, error: &err)
println(str!)
Line 1,693 ⟶ 1,694:
 
var str = "\t"
for i in 1..<C_ARGCargs.count {
str += String.fromCString(C_ARGVargs[Int(i)])! + " "
}
 
Anonymous user