简体   繁体   中英

How can all commands be removed

In the command.remove() example I can find and remove one command.

Eg.

const all = vorpal.find('*');
for (var cmd of all) {
  cmd.remove();
}

Is there an official way to remove all commands?

It's simple enough that there doesn't really need to be an API method for it.

All commands are exposed through vorpal.commands . So:

vorpal.commands.forEach(function (cmd) {
  cmd.remove();
});

That should work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM