diff --git a/blash.js b/blash.js index b795d33..1c4a469 100644 --- a/blash.js +++ b/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 = '
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 = "
\n" + cmds[i]; + } + } + } + this.prompt.focus(); } } diff --git a/blash.json b/blash.json index 42dd421..a930a81 100644 --- a/blash.json +++ b/blash.json @@ -86,26 +86,6 @@ }, }, - { - "name" : "clear", - - "info" : { - "syntax" : "clear", - "brief" : "Clear the terminal screen", - }, - - "action" : function ( arg ) { - var out = ''; - - shell.window.innerHTML = - '' + - '' + - ''; - - return out; - }, - }, - { "name" : "man",