Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alexito4/swift-command-line-helper
Some helper functions to write command line scripts with Swift.
https://github.com/alexito4/swift-command-line-helper
Last synced: 1 day ago
JSON representation
Some helper functions to write command line scripts with Swift.
- Host: GitHub
- URL: https://github.com/alexito4/swift-command-line-helper
- Owner: alexito4
- Created: 2014-09-07T12:35:01.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-09-07T12:47:19.000Z (over 10 years ago)
- Last Synced: 2024-11-08T21:23:50.119Z (about 2 months ago)
- Language: Swift
- Size: 129 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Swift-Command-Line-Helper
=========================Some helper functions to write command line scripts with Swift.
## Working with the current direcotry
Consult the current direcotry:
CLH.currentDirectoryPath()
// /Users/Alex/...Change the current direcotry:
CLH.changeToHome() // /Users/Alex
CLH.changeToDesktop() // /Users/Alex/Desktop
let testPath = CLH.currentDirectoryPath() + "/test"
CLH.changeToDirectory(testPath) // /Users/Alex/Desktop/test
## Working with directoriesCreate a new directory:
CLH.createDirectoryAtPath(testPath)
// Created /Users/Alex/Desktop/test
List the contents of a directory:CLH.contentsOfDirectoryAtPath(testPath)
// [/Users/Alex/Desktop/test/test1.txt, ...]
for (i, file) in enumerate(CLH.contentsOfDirectoryAtPath(testPath)) {
println(file)
}
## Working with filesCreate an empty file:
CLH.touchFile("test1.txt")
Rename a file:
CLH.renameFileWithName("test1.txt", toName: "testOne.txt")