feat(tty): Add --no-input flag and TTY checks for interactive commands#79
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
| eprintln!( | ||
| "error: 'connections new' is interactive and stdin is not a TTY. \ | ||
| Use 'hotdata connections create list' to discover types and their config schemas, \ | ||
| then 'hotdata connections create --name <n> --type <t> --config '{{…}}''." |
There was a problem hiding this comment.
nit: (not blocking) The placeholders <n> and <t> are easy to misread — <name> and <type> would match the actual flag names and be clearer to anyone copy-pasting. Also the nested single quotes in --config '{{…}}' produce a shell-broken example as displayed (terminating then immediately reopening); double-quoting the JSON would be friendlier, e.g.:
hotdata connections create --name <name> --type <type> --config '{"...": "..."}'
| return false; | ||
| } | ||
| if std::env::var_os("CI").is_some() { | ||
| return false; |
There was a problem hiding this comment.
super nit: (not blocking) The CI env check has no escape hatch — a developer with CI=1 exported locally (some sandboxes/test harnesses set it) can't run any interactive command, and --no-input only opts further into non-interactive. Not blocking since the workaround is CI= hotdata ..., but worth a thought if you'd rather gate this strictly on the TTY check + the explicit flag.
| if !crate::util::is_interactive() { | ||
| eprintln!( | ||
| "error: stdin is not a TTY; cannot prompt for selection. \ | ||
| Run 'hotdata workspaces list' to see available IDs, \ | ||
| then 'hotdata workspaces set <workspace_id>'." | ||
| ); | ||
| std::process::exit(1); | ||
| } |
There was a problem hiding this comment.
super nit: (not blocking) The interactivity check could move above the api.get("/workspaces") call (gated on workspace_id.is_none()) so non-interactive callers fail without burning a network round-trip. Just a small ergonomic win.
No description provided.