Skip to content

v0.x: Props.IO, and the setup wizards' test seams

Spec 0198, landing in phases. This note grows with them.

Phase 1: the streams on Props

  • Props.IO (props.IO interface, props.StdIO default) is the invocation's stdin, stdout and stderr, and whether a person is at them. A nil field reads as the process's streams through GetIO(); nothing changes for a tool that never sets it. The root fills it from cobra in its pre-run.
  • --accessible / GTB_ACCESSIBLE=true on every GTB-based tool asks for line prompts (huh's accessible mode) instead of a full-screen form.
  • setup.RunForm(ctx, p, form) is how a framework form runs: on the IO's streams, with the IO's accessible decision, refusing a stdin that is neither a terminal nor accessible (setup.ErrNonInteractive).
  • Tests drive real forms through Props.IO with internal/formtest; see the testing guide. The form-creator options come out in phase 2.