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…).

Hi!

I see these CLI issues are still around today. Do you know when this can be fixed?

I’m using 2.2.0-rc2 and I’m trying to edit the sites bindings, but I can’t even change the Binding Port, which defaults to 8080.

Thanks in advance!

1 Like

Alas, I feel your pain… it’s been soooooo many years of torture…

The blame is not all Pydio’s. The issue is with one of the libraries they’re using, very likely promptui. This library has suffered from that issue for æons, and finally, someone even volunteered to fix the code with a pull request, but, alas, it’s still waiting for validation.

I guess the Pydio folks are just waiting for those changes to be merged with the promptui trunk, and then Cells will automagically have no further CLI issues…

Yeah, for info, we upgrade to promptui 0.8.0 for the 2.2 release.
It is the last released version and fixes most of the issues.

1 Like

It hasn’t fixed one issue, though: when a line is too big to fit on the screen (this happens a lot when copying & pasting an access key, for instance), although it correctly splits the line visually, it also gets replicated over and over again — once for each character beyond the limits of the screen, to be more precise. While it makes everything hard to see, the good news is that the overall prompt is working, so, say, pressing return will work and the correct string will be saved — nothing will have been truncated, no extra characters added, etc.

This might not be an issue where promptui is 100% to blame. For example, since ancient times I have always changed the bash prompt on my Mac’s Terminal to include the current working directory — mostly because I’m fond of having 3-4 remote shells open at the same time, and I wish to quickly figure out which is which. However, when the path gets too long — again, having more characters than the terminal’s width — weird things start to happen when typing commands, and they’re far more ‘destructive’ than what promptui does (namely, extraneous characters may pop in, the cursor is lost and will probably be under the wrong characters, etc.). It’s been a long time since I used anything else besides the macOS Terminal, so it’s safe to assume that there is something on the configuration that is messing things up at some stage.

Granted, it could also be my own .bashrc interfering with how the terminal works… promptui, in this case, would just be an innocent victim!

Still, the CLI for Cells 2.2.3 seems to have far fewer issues overall. Great work on that!

1 Like