onepub-dev/dcli

Implement editing for the Ask function.

Open

#161 opened on Sep 22, 2021

 (0 comments) (1 reaction) (0 assignees)Dart (30 forks)auto 404
enhancementhelp wanted

Repository metrics

Stars
 (266 stars)
PR merge metrics
 (PR metrics pending)

Description

We regularly get requests to support editing when a user is entering input into the ask function.

It would be great if we could support the following edit functions in the Ask prompt

cursor left/right del key backspace (already supported on most terminals).

These functions are likely to only work when the terminal supports ansi escape sequences.

As such we need to work out what to do when an ansi terminal isn't available (presumable drop back to the current support of just backspace).

We currently use the dart_console package for handling a no. of the terminal functions. It would be my preference that we keep using this package.

Dart also sometimes incorrectly reports whether we have an ansi terminal. Do we need a method to force ansi support even when Dart doesn't detect it?

Scenarios that I would like to see supported is using ask in:

  • a docker terminal (e.g. you connect to a docker cli and then run a dart script).
  • an ssh session

We have also had a report that the backspace character doesn't work on some mac terminals. This may be because we are using linemode when reading from stdin. This issue may also fix that problem.

Contributor guide