Files

44 lines
1.1 KiB
Plaintext

let lines = [];
lines.push("==================================================");
lines.push(" TETANUS SYSTEM INFORMATION");
lines.push("==================================================");
// 1. Format Config Map (Settings)
lines.push("");
lines.push("[Settings]");
let keys = config.keys();
for k in keys {
lines.push("- " + k + ": " + config[k]);
}
// 2. Format Project List
lines.push("");
lines.push("[Active Projects]");
lines.push(fill_space("Customer Name", 20) + " | " + fill_space("Project Name", 20) + " | Stage");
lines.push("--------------------------------------------------");
for p in projects {
let customer = p.org_name;
let name = p.name;
let stage = "upcoming";
if p.current == true{
stage = "current";
}
lines.push(fill_space(customer, 20) + " | " + fill_space(name, 20) + " | " + stage);
}
lines.push("--------------------------------------------------");
// Return the array of lines back to Rust
lines;
// Helper function for padding spaces
fn fill_space(text, len) {
let s = text.to_string();
while s.len < len {
s += " ";
}
return s;
}