The plugin enables auto completion of native TinyShell command plugins, files and folders. If more than one value is found, all suggestions are printed.
Command line interface
Syntax
Begin typing a plugin command, filename or folder name, and then press the TAB keyboard key, when no TinyShell application is being executed.
keyboard_tabbing.php
- <?
- require("../plugin.php");
- if (is_ajax()) {
- if ($_POST["action"] == 'ls') {
- $list = @glob($_POST['start']."*");
- if ($list) {
- $i = 0;
- foreach ($list as $k => $v) {
- if ($i++) echo "\n";
- echo is_dir($v) ? $v."/" : $v;
- }
- }
- }
- exit;
- }
- ?>
- /**
- * Auto complete from directory
- **/
- ts.onkeydown.push(function(e) {
- if (!this.proc && e.key == 'tab' && !e.shift) {
- e.stop();
- if (this.cursor_read_line().test(/\s/)) this.ajax_request(this.cursor_autocomplete, "<?php echo $_AJAX_URL?>", "action=ls&start="+encodeURIComponent(this.cursor_read_word()));
- else {
- // suggest commands
- var plugs = [];
- for (plugin in TinyShell.plugins) plugs.push(plugin+" ");
- plugs.sort();
- this.cursor_autocomplete(plugs.join("\n"));
- }
- return false;
- }
- return true;
- });