Cells CLI configuration: terminal issues (no backspace, lines duplicated, etc.)

Hi,

I’m not sure if this was reported earlier, but I’ve been having a few issues when using the CLI console to make changes. I’m using macOS (currently 10.14.6 Beta) to log in to a FreeBSD server (11.2-RELEASE-p4) where Cells is installed.

Backspace does not seem to work (I’ve tried everything, from ^H to Ctrl-Backspace and so forth) except when pressing it for the first time in an unedited line — which will promptly clear the whole line. Afterwards, backspace is ‘dead’ until Enter is pressed (to avoid mistakes, I have been writing whatever is needed on another console and doing copy & paste…).

And lines are duplicated a lot of times, something which happens with very long lines — which will be the case for long pathnames (say, for the certificates). With each additional character, the line gets duplicated, etc. It’s annoying!

Looking at the code, it seems that Cells is using a forked version of promptui to deal with the CLI input and subsequent parsing. Sadly it’s not a very recent version, but searching for the symptoms I’ve got, I managed to find an answer — more specifically, a proposed hack to make the terminal behave a bit better.

These patches require a bit more work to implement since Pydio’s own forked promptui lags behind the ‘original’. There is no easy way to do everything manually, it’s really a question of compiling, see what functions are missing, get them from the original, patch Pydio’s code, build & install again, rinse & repeat until no more errors are found.

Eventually, I got rid of the duplicate lines issue (or at least it seems like that to me), but not the backspace issue, so I suspect it’s a terminal thing (i.e. something with my terminal configuration), either locally or remotely (I’ve also used an xterm window from XQuartz, but it’s even worse, IMHO).

In either case, I would recommend updating promptui to a more recent version, and at least apply the above-mentioned hack/patch to remove the duplicated lines…

Hey,
We’re not really using a “forked” version (no pydio specific modifs) but a “vendored” version. As this lib is only used by our cmd’s, it would probably not be very hard to update the version (unless the promptui api’s changed a lot ?).
Maybe you can try that by using the govendor tool (https://github.com/kardianos/govendor): once installed, if the promptui package is up-to-date in your GOPATH, you can try running govendor update github.com/manifoldco/promptui from the root of the cells project, and see what happens… It can take a while on Mac.
-c

1 Like

Whoops… I followed your suggestion immediately, of course, but managed to completely break the compilation :smiley: … but it’s all my fault, I think I went overboard using govendor, a tool I had never used and which seems intriguing in what it does, and, more specifically, what it does not do!

Thankfully, I never pressed the ‘Send’ button on the email message I was writing to a potential customer to try Cells out :rofl: Now I need a few days to fix what I broke!

But more to the point, I’ll let you know how it went. And yes, promptui changed quite a lot, but I believe that the API didn’t.

Whew. I basically started from scratch again, i.e. with a fresh copy of github.com/manifoldco/promptui and letting govendor update the proper directory (my problem was that govendor for some reason didn’t want to update promptui, it did ‘nothing’ but also didn’t drop any errors). Then I applied the patch/hack mentioned before, made a clean build, and everything works again! (yay!)

I’ve tried some CLI input, and everything seems to work well except backspace. I wonder if this is a limitation of github.com/chzyer/readline which is used by promptui; I would have to run a few tests (/me makes a mental note) to figure out what exactly is happening. I believe that it’s the FreeBSD configuration I’ve got, I’m a fan of the Nord colour palette, but maybe the implementation I got has some flaws in terms of terminal support (at least under FreeBSD…).