|
// retoor <retoor@molodetz.nl>
|
|
import "os" for Platform, Process
|
|
import "io" for Directory
|
|
|
|
class Dashboard {
|
|
static show() {
|
|
System.print("========================================")
|
|
System.print(" WREN CLI SYSTEM DASHBOARD ")
|
|
System.print("========================================")
|
|
|
|
System.print("PLATFORM INFO:")
|
|
System.print(" OS Name: %(Platform.name)")
|
|
System.print(" POSIX: %(Platform.isPosix)")
|
|
System.print(" Home: %(Platform.homePath)")
|
|
|
|
System.print("\nPROCESS INFO:")
|
|
System.print(" PID: %(Process.pid)")
|
|
System.print(" PPID: %(Process.ppid)")
|
|
System.print(" CWD: %(Process.cwd)")
|
|
System.print(" Version: %(Process.version)")
|
|
|
|
System.print("\nARGUMENTS:")
|
|
if (Process.arguments.count == 0) {
|
|
System.print(" (none)")
|
|
} else {
|
|
for (i in 0...Process.arguments.count) {
|
|
System.print(" [%(i)]: %(Process.arguments[i])")
|
|
}
|
|
}
|
|
|
|
System.print("\nWORKING DIRECTORY FILES:")
|
|
var files = Directory.list(".")
|
|
files.sort(Fn.new {|a, b|
|
|
var ba = a.bytes
|
|
var bb = b.bytes
|
|
var len = ba.count < bb.count ? ba.count : bb.count
|
|
for (i in 0...len) {
|
|
if (ba[i] < bb[i]) return true
|
|
if (ba[i] > bb[i]) return false
|
|
}
|
|
return ba.count < bb.count
|
|
})
|
|
|
|
var count = 0
|
|
for (file in files) {
|
|
if (count > 10) {
|
|
System.print(" ... and %(files.count - 10) more")
|
|
break
|
|
}
|
|
System.print(" - %(file)")
|
|
count = count + 1
|
|
}
|
|
System.print("========================================")
|
|
}
|
|
}
|
|
|
|
Dashboard.show()
|