Implemented filter
This commit is contained in:
@@ -14,8 +14,10 @@ function Commander()
|
||||
|
||||
this.validate = function(q = ronin.commander.query())
|
||||
{
|
||||
console.info(q.string)
|
||||
if(!ronin.modules[q.module]){ console.log("Unknown module",q.module); return; }
|
||||
if(q.raw.indexOf("$") > -1){ console.log("Variables present"); return; }
|
||||
if(q.raw.indexOf(";") > -1){ this.validate_multi(q); return; }
|
||||
|
||||
// Update settings
|
||||
for(setting_id in q.settings){
|
||||
@@ -38,6 +40,32 @@ function Commander()
|
||||
ronin.guide.update();
|
||||
}
|
||||
|
||||
this.queue = [];
|
||||
|
||||
this.validate_multi = function(q)
|
||||
{
|
||||
var queue = [];
|
||||
var queries = q.string.split(";");
|
||||
|
||||
for(id in queries){
|
||||
var q = new Query(queries[id].trim());
|
||||
queue.push(q);
|
||||
}
|
||||
this.queue = queue;
|
||||
this.run_queue();
|
||||
}
|
||||
|
||||
this.run_queue = function()
|
||||
{
|
||||
if(ronin.commander.queue.length == 0){ return; }
|
||||
|
||||
ronin.commander.validate(ronin.commander.queue[0]);
|
||||
|
||||
ronin.commander.queue = ronin.commander.queue.splice(1,ronin.commander.queue.length-1)
|
||||
|
||||
setTimeout(ronin.commander.run_queue,250);
|
||||
}
|
||||
|
||||
this.update = function()
|
||||
{
|
||||
var q = ronin.commander.query();
|
||||
|
||||
@@ -5,16 +5,24 @@ function Docs()
|
||||
var html = "";
|
||||
|
||||
html += this.print_intro();
|
||||
html += "## Cursor\n";
|
||||
html += "- `$` replace with **Pos**.\n";
|
||||
html += "- `$+shift` replace with **Rect**.\n\n";
|
||||
|
||||
html += "## Modules\n";
|
||||
html += this.print_modules(ronin.modules);
|
||||
|
||||
html += this.print_license();
|
||||
|
||||
dialog.showSaveDialog((fileName) => {
|
||||
if (fileName === undefined){ return; }
|
||||
fs.writeFile(fileName, html, (err) => {
|
||||
if(err){ alert("An error ocurred creating the file "+ err.message); return; }
|
||||
});
|
||||
// dialog.showSaveDialog((fileName) => {
|
||||
// if (fileName === undefined){ return; }
|
||||
// console.log(fileName)
|
||||
// fs.writeFile(fileName, html, (err) => {
|
||||
// if(err){ alert("An error ocurred creating the file "+ err.message); return; }
|
||||
// });
|
||||
// });
|
||||
|
||||
fs.writeFile("/Users/VillaMoirai/Github/HundredRabbits/Ronin/README.md", html, (err) => {
|
||||
if(err){ alert("An error ocurred creating the file "+ err.message); return; }
|
||||
});
|
||||
|
||||
return html;
|
||||
@@ -36,13 +44,24 @@ function Docs()
|
||||
var module = modules[module_name];
|
||||
html += "## "+module_name+"\n\n";
|
||||
html += module.docs+"\n\n";
|
||||
html += this.print_settings(module.settings)+"\n";
|
||||
html += this.print_methods(module.methods)+"\n";
|
||||
html += this.print_settings(module.settings)+"\n";
|
||||
html += this.print_ports(module.ports)+"\n";
|
||||
}
|
||||
return html+"\n";
|
||||
}
|
||||
|
||||
this.print_methods = function(methods)
|
||||
{
|
||||
var html = "### Methods\n";
|
||||
|
||||
for(method_name in methods){
|
||||
var method = methods[method_name];
|
||||
html += "- `"+method_name+":"+method.params+"` "+method.info+"\n";
|
||||
}
|
||||
return html;
|
||||
}
|
||||
|
||||
this.print_settings = function(settings)
|
||||
{
|
||||
var html = "### Settings\n";
|
||||
@@ -54,16 +73,6 @@ function Docs()
|
||||
return html;
|
||||
}
|
||||
|
||||
this.print_methods = function(methods)
|
||||
{
|
||||
var html = "### Methods\n";
|
||||
|
||||
for(method_name in methods){
|
||||
var method_val = methods[method_name];
|
||||
html += "- `"+method_name+":`, no details.\n";
|
||||
}
|
||||
return html;
|
||||
}
|
||||
|
||||
this.print_ports = function(ports)
|
||||
{
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
function Method(name,params,info = "Missing documentation")
|
||||
function Method(name,params,info = "Missing documentation",f)
|
||||
{
|
||||
this.name = name;
|
||||
this.params = params;
|
||||
this.info = info;
|
||||
|
||||
this.run = null;
|
||||
this.run = f;
|
||||
|
||||
this.hint = function()
|
||||
{
|
||||
@@ -13,6 +12,6 @@ function Method(name,params,info = "Missing documentation")
|
||||
|
||||
this.docs = function()
|
||||
{
|
||||
return "["+this.params+"] <i>"+this.info+"</i>";
|
||||
return "<b>"+this.params+"</b> <i>"+this.info+"</i>";
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
function Query(query_str = "")
|
||||
{
|
||||
this.string = query_str;
|
||||
this.module = query_str.split(" ")[0];
|
||||
var parts = query_str.split(" ").splice(1);
|
||||
this.raw = parts.join(" ");
|
||||
|
||||
Reference in New Issue
Block a user