Skip to content

feat(tty): Add --no-input flag and TTY checks for interactive commands#79

Merged
pthurlow merged 1 commit into
mainfrom
feat/no-input
May 12, 2026
Merged

feat(tty): Add --no-input flag and TTY checks for interactive commands#79
pthurlow merged 1 commit into
mainfrom
feat/no-input

Conversation

@pthurlow
Copy link
Copy Markdown
Collaborator

No description provided.

@sentry
Copy link
Copy Markdown

sentry Bot commented May 12, 2026

Codecov Report

❌ Patch coverage is 7.69231% with 24 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/util.rs 0.00% 12 Missing ⚠️
src/connections_new.rs 0.00% 4 Missing ⚠️
src/workspace.rs 0.00% 4 Missing ⚠️
src/auth.rs 0.00% 3 Missing ⚠️
src/main.rs 66.66% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Comment thread src/connections_new.rs
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 '{{…}}''."
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 '{"...": "..."}'

Comment thread src/util.rs
return false;
}
if std::env::var_os("CI").is_some() {
return false;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/workspace.rs
Comment on lines +46 to +53
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);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@pthurlow pthurlow merged commit 7411257 into main May 12, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant