Question

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']);
};
Was it helpful?

Solution

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

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

I think that there should be one option for both of them just like with login.

Because it's a function you can use different values depend on the place of the string (like with bash shell where first is command and next is filename or directory depend on used command).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top