Skip to main content

Module init_tui

Module init_tui 

Source
Expand description

Interactive first-run helpers for taskfast init.

The non-interactive path (flag / env / config driven) is the default and unchanged — see cmd/init.rs. This module gates the TTY-only branch: when a human runs taskfast init with no credentials resolvable, we prompt for a PAT, greet via GET /users/me, and walk wallet provisioning.

All interactive surface goes through Prompter so tests can inject a scripted implementation without driving a real TTY.

Structs§

DialoguerPrompter
Real Prompter backed by dialoguer. Uses the crate’s default colorful theme so the PAT prompt, select list, etc. match standard CLI ergonomics.

Enums§

WalletMode
Wallet-provisioning choice surfaced by the interactive prompt. Mirrors the three mutually-exclusive flag paths (--wallet-address, --generate-wallet, --skip-wallet).

Traits§

Prompter
Test-seam trait covering every TTY interaction the init flow needs. The real implementation (DialoguerPrompter) reads from the terminal; tests inject a scripted double.

Functions§

greeting
Format the post-auth greeting. With a profile: "Hi Name <email>". Without one (server lacks /users/me, returned 404): a generic authenticated message so the user still gets visible confirmation.
is_interactive
True when both stdin and stdout are attached to a terminal. False in pipes, redirects, CI, and under the test harness — callers use this to decide whether prompting is safe.