hoaproject / Console

The Hoa\Console library.

Home Page:https://hoa-project.net/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

unset Autocompleter

1e1 opened this issue · comments

commented

We can't unset an autocompleter.

If I do $rl->setAutocompleter(null);, I obtain:

Fatal error: Uncaught TypeError: Argument 1 passed to Hoa\Console\Readline\Readline::setAutocompleter() must implement interface Hoa\Console\Readline\Autocompleter\Autocompleter, null given

Can you add the unsetAutocompleter() method?

Yup, you cannot.

You can use the aggregate autocompleter, namely Hoa\Console\Readline\Autocompleter\Aggregate. It wraps the collection of autocompleters inside an ArrayObject. With the getAutocompleters method, you can set add or remove autocompleters on-the-fly.