Closed crackytsi closed 2 years ago
You need:
}, {
autocompleteMenu: true,
completion: Object.keys(commands),
greetings: 'php example'
});
PS: you should not use onBlur: return false
it was the first solution that prevent the terminal to work on mobile. Where did you find it? I need to remove it from every possible place.
@jcubic Thank you very much. Actually I retrieved it from mentioned URL and I just validated against (so it seems to make sense for me):
https://terminal.jcubic.pl/api_reference.php
onBlur [function(terminal)] — callback function called when terminal get out of focus. If you return false in this callback function the terminal will not get out of focus.
One last question regarding autocompletion topic: If I have parameters related to the commands e.g. in a structure like this:
{
"command1": {
"args": [
{
"name": "parameterA"
},
{
"name": "parameterB"
}
]
},
"command2": {
"args": [
{
"name": "parameterC"
},
{
"name": "parameterD"
}
]
}
}
How can autocompletion handle the parameters, depending on teh command? I tried to understand it from the docs, but this is something that seems to be not designed? So once a command is found, I would like to "change" the possible autocompletions for all parameters related to the command.
You need to use the completion function where you parse the command in order to provide proper completion. Here is an example https://codepen.io/jcubic/pen/MJyYEx?editors=0010
I have question related to jQuery Terminal
How can I apply auto-complete of commands, if the commands are in an external json file? I wrote something like https://stackoverflow.com/questions/48656165/get-php-data-using-jquery-terminal But setting "autocompleteMenu: true" seems not to have the expected effect.
Example: