Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
38 lines (36 sloc) 844 Bytes
function show_help(var args) {
print("Usage: ");
print(args[0]);
say(" [directory]");
exit(0);
}
function main[main](var args) {
var rosella = load_packfile("rosella/core.pbc");
var(Rosella.initialize_rosella)("filesystem");
var dirname = ".";
for(var i = 1; i < args; i++) {
var arg = args[i];
if(arg == "-h" || arg == "--help")
show_help(args);
else
dirname = arg;
}
var dir = new Rosella.FileSystem.Directory(dirname);
if(!(dir.exists())) {
print("ls: cannot access ");
print(dirname);
say(": No such file or directory");
exit(-1);
}
var files = dir.get_files();
for(var file in files) {
print(file.short_name());
print(" ");
}
var dirs = dir.get_subdirectories();
for(var curdir in dirs) {
print(curdir.short_name());
print(" ");
}
say("");
}
Something went wrong with that request. Please try again.