diff --git a/default-modules/info/config.conf b/default-modules/info/config.conf new file mode 100644 index 0000000..f152714 --- /dev/null +++ b/default-modules/info/config.conf @@ -0,0 +1,4 @@ +name: info +output_type: String, +new_thread: false +args: config_file,config,projects diff --git a/default-modules/info/help.txt b/default-modules/info/help.txt new file mode 100644 index 0000000..b3e95ce --- /dev/null +++ b/default-modules/info/help.txt @@ -0,0 +1 @@ +Show information about the tool including current settings and loaded modules. diff --git a/default-modules/info/script.rhai b/default-modules/info/script.rhai new file mode 100644 index 0000000..1661846 --- /dev/null +++ b/default-modules/info/script.rhai @@ -0,0 +1,43 @@ +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; +}