{ "name" : "find", "info" : { "syntax" : "find <text|regex>", "brief" : "Search for file or directories in the root hierarchy", }, "action" : function ( arg ) { var out = ''; if ( !arg || arg.length == 0 ) { return "Argument required
\n"; } if ( arg.match ( "^['\"](.*)['\"]$" )) { arg = RegExp.$1; } var re = new RegExp ( arg, "i" ); for ( var i in shell.files ) { var dir = shell.files[i]; if ( dir.path.match ( re )) { if ( dir.type == 'directory' ) { out += '' + dir.path + "
\n"; } else if ( dir.type == 'file' && dir.href ) { out += '' + '' + dir.path + "
\n"; } else { out += dir.path + "
\n"; } } } return out; }, }