dthree / vorpal

Node's framework for interactive CLIs
http://vorpal.js.org
MIT License
5.64k stars 280 forks source link

Importing Cash module causes issue with Vorpal / Command history not working #233

Open mke66djx opened 7 years ago

mke66djx commented 7 years ago

Hi guys,very confusing- running the below seems to interfere with the main vorpal instance. I dont see how that's possible unless they use the same cache or other common files.

If you run the below and hit up and down you will see the history not working. Removing the cash import will fix the issue.

const Vorpal = require('vorpal'); const mainScreenVorpal = new Vorpal(); const cash = require('cash'); mainScreenVorpal .delimiter('home-mode~>') .history('mainScreenId') .show();

milesj commented 7 years ago

Is there a use case for multiple Vorpal instances?

mke66djx commented 7 years ago

Yes, in my case I have different user modes which each have their own command sets and workspaces. Vorpal was actually designed with this use case in mind.

mke66djx commented 7 years ago

Not sure is anyone is using any extensions because I dont see much activity here but it looks like simply running .use(cash) is generating an error;

...node_modules\vorpal\dist\history.js:146 this._localStorage.setItem(this._storageKey, JSON.stringify(persistedHistory));

TypeError: Converting circular structure to JSON

Is anyone else getting this to work?