[Wilds] Provide a skeleton for prompt behaviors

Authored by epriestley on Sep 25 2018, 4:07 PM.


[Wilds] Provide a skeleton for prompt behaviors

Ref T13098. Ref T13198. Ref T12996. The major ideas here are:

Workflows must define a list of all the prompts they can raise, so that these prompts can be enumerated with arc prompts <workflow>.

Prompts themselves should respond properly to ^C (abort immediately) and we should be able to make them nonblocking in the future (particularly, we'd like to be able to continue reading bytes from subprocess buffers while the prompt is shown on screen).

This doesn't have a lot of fancy features yet (non-confirm prompts, default yes, prompts which don't abort on "N", etc) but those should be easy to add later.

In the future, you'll be able to configure a default answer to prompts either in a config file or at runtime with --config prompts=x.y.z=N or similar.

This removes the history/readline mode for prompts, where you could use the up arrow to cycle through older responses. I believe this was only really useful for "excuse" prompts and intend to remove those.

Test Plan:
Forced arc shell-complete to always prompt, then:

  • Got prompted, answered "y", "n", "N", "", "quack". Got sensible behavior in all cases.
  • Ran echo | arc shell-complete, got a TTY error.
  • Ran arc prompts, arc prompts shell-complete.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13098, T13198, T12996

Differential Revision: https://secure.phabricator.com/D19706