1

Does anyone have a code snippet showing how to get Jquery Terminal tab completion working?

http://terminal.jcubic.pl/

http://terminal.jcubic.pl/api_reference.php

I'm getting the function call OK, what's confusing me is how to return the set of possible completion values.

And the doco is leaving me a little in the dark:

completion [function (terminal, string, callback)] — callback need to be executed when list of commands for tab completion is ready, you need to pass array of commands to callback function.

This doesn't seem to work:

FileConsole.prototype.onTab = function(terminal, command, callback) {
    callback(['big', 'hairy', 'gorilla']);
};
4

1 回答 1

4
$(...).terminal(..., {

    tabcompletion: true, // this option can be removed in latest version
    completion: function(terminal, command, callback) {
        callback(['big', 'hairy', 'gorilla']);
    }
});

我认为他们两个都应该有一个选项,就像登录一样。

因为它是一个函数,所以您可以根据字符串的位置使用不同的值(例如 bash shell,其中 first 是命令,接下来是文件名或目录,取决于使用的命令)。

于 2013-11-16T07:07:13.670 回答