flux icon indicating copy to clipboard operation
flux copied to clipboard

Improve REPL interface

Open nathanielc opened this issue 6 years ago • 2 comments

Some feedback we received about the REPL:

Autocomplete uses TAB instead of ENTER, this UX causes users to frequently submit partially typed queries.

The only way to quit the REPL is to send EOF (Ctrl-D), this was confusing to most users, perhaps using SIGINT (Ctrl-C) when the input line is empty should quit. We want to preserve SIGINT for canceling running queries so making it also quit will require understanding that state.

There is no way to input multiple lines. Since the Flux language naturally prefers multiple lines we need a convenient way to input multiple lines. Perhaps a SHIFT-ENTER submits the query, and a normal ENTER just adds a new line? This should also play nice with yield.

The hidden behavior of run was confusing, some feedback was to change the behavior of the REPL and execute queries if there was no variable assignment. This way yield remains implicit in most cases. This would remove the need to have a run method as simply entering the identifier of a saved query would run it. If you are building up a query then use variable assignment or multi-line input methods.

We should probably use a real readline backend for the REPL so both vim and emacs bindings can exist as is expected by users.

nathanielc avatar Sep 24 '18 16:09 nathanielc

I recently made some changes to how we propagate errors from the Flux controller. As a result the error formatting in the platform REPL is a little more wonky than before, unfortunately:

> from(bucket: "telegraf")
Error: <invalid> failed to create physical plan: result 'from0' is unbounded. Add a 'range' call to bound the query

The <invalid> in the message above is new, and is how platform.Error messages are formatted. "Invalid" reflects that a 400 error code was returned by the query service, which is now returning platform.Error when queries fail.

Since the REPL code lives in the Flux repo and cannot depend on platform we'll need to figure out the best way to make error messages pretty when they are returned from a remote server.

wolffcm avatar Dec 14 '18 17:12 wolffcm

Need to improve the documentation page for the REPL usage. I found the exit method of cntrl-D by accident by using my Home Simpson method of mashing the keyboard

RexBarker avatar Aug 05 '19 21:08 RexBarker