Tab support now
This commit is contained in:
parent
853afd8c57
commit
1c03dfa5ce
2 changed files with 40 additions and 20 deletions
40
blash.js
40
blash.js
|
@ -146,6 +146,46 @@ function blash ()
|
|||
}
|
||||
}
|
||||
|
||||
this.prompt.focus();
|
||||
} else if ( key == 9 ) {
|
||||
var complete_type = '';
|
||||
|
||||
if ( this.prompt.value.match ( /\s/ ))
|
||||
{
|
||||
complete_type = 'file';
|
||||
} else {
|
||||
complete_type = 'cmd';
|
||||
}
|
||||
|
||||
if ( complete_type == 'cmd' )
|
||||
{
|
||||
var cmds = new Array();
|
||||
|
||||
for ( var i in shell.json.commands )
|
||||
{
|
||||
var re = new RegExp ( '^' + this.prompt.value );
|
||||
|
||||
if ( shell.json.commands[i].name.match ( re ))
|
||||
{
|
||||
cmds.push ( shell.json.commands[i].name );
|
||||
}
|
||||
}
|
||||
|
||||
if ( cmds.length == 0 )
|
||||
{
|
||||
this.cmdOut.innerHTML = '<br/>Sorry, no matches for `' + this.prompt.value + "'";
|
||||
} else if ( cmds.length == 1 ) {
|
||||
this.prompt.value = cmds[0] + ' ';
|
||||
} else {
|
||||
this.cmdOut.innerHTML = '';
|
||||
|
||||
for ( var i in cmds )
|
||||
{
|
||||
this.cmdOut.innerHTML = "<br/>\n" + cmds[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.prompt.focus();
|
||||
}
|
||||
}
|
||||
|
|
20
blash.json
20
blash.json
|
@ -86,26 +86,6 @@
|
|||
},
|
||||
},
|
||||
|
||||
{
|
||||
"name" : "clear",
|
||||
|
||||
"info" : {
|
||||
"syntax" : "clear",
|
||||
"brief" : "Clear the terminal screen",
|
||||
},
|
||||
|
||||
"action" : function ( arg ) {
|
||||
var out = '';
|
||||
|
||||
shell.window.innerHTML =
|
||||
'<span id="promptText" class="promptText"></span>' +
|
||||
'<input type="text" class="promptInput" name="blashPrompt" autocomplete="off" onkeyup="shell.getKey ( event )"/>' +
|
||||
'<span id="blashCmdOut" class="blashCmdOut"/></span>';
|
||||
|
||||
return out;
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"name" : "man",
|
||||
|
||||
|
|
Loading…
Reference in a new issue