Console
type (joe.console
)
This static type provides a modicum of access to the console environment, sufficient to writing simple scripts.
- Console.args() → List
- Console.cd(path) → Path
- Console.exit([code])
- Console.mkdir(path)
- Console.pwd() → Path
- Console.read() → String
- Console.readFile(filePath) → String
- Console.readLines(filePath) → List
- Console.writeFile(filePath, text)
Static Methods
Console.args()
Console.args() → List
Returns a list of the arguments passed to the command line, as filtered by the application.
Console.cd()
Console.cd(path) → Path
Changes the current working directory to the given path. If the path is relative, it is treated as relative to the current working directory.
Console.exit()
Console.exit([code])
Exits the application with the given exit code, which defaults to 0.
Console.mkdir()
Console.mkdir(path)
Creates the directory given its path, including any required parent directories. If the path is relative, it is treated as relative to the current working directory.
Console.pwd()
Console.pwd() → Path
Returns the current working directory.
Console.read()
Console.read() → String
Returns a string from standard input, or null at EOF.
Console.readFile()
Console.readFile(filePath) → String
Reads the contents of the file at the given filePath and returns it as a string.
Console.readLines()
Console.readLines(filePath) → List
Reads the contents of the file at the given filePath and returns it as a list of line strings
Console.writeFile()
Console.writeFile(filePath, text)
Writes the text as a file at the given filePath.