Skip to content

feat: add is_dumb public function#290

Merged
djc merged 2 commits into
console-rs:mainfrom
ugur-eren:feat/add-is-dumb-public-function
Jul 1, 2026
Merged

feat: add is_dumb public function#290
djc merged 2 commits into
console-rs:mainfrom
ugur-eren:feat/add-is-dumb-public-function

Conversation

@ugur-eren

@ugur-eren ugur-eren commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Add public is_dumb() function

Exposes a new public function is_dumb() that provides a fast way to check whether the application has a "dumb" terminal (i.e. TERM is unset or set to dumb on Unix; TERM explicitly set to dumb on Windows).

This logic previously existed only as an inline check inside is_a_color_terminal(). This PR extracts it into a dedicated is_a_dumb_terminal() function per platform (unix_term.rs, windows_term/mod.rs, wasm_term.rs), and wires it up through a new public is_dumb() in term.rs, re-exported from lib.rs.

Behavior

No change to existing is_a_color_terminal() output. This is a pure refactor for that path. New behavior is only the addition of the standalone is_dumb() API.

Note

is_dumb() semantics differ slightly by platform when TERM is unset (Unix treats unset as dumb but Windows does not, since native Windows terminals typically don't set TERM).

This is intentional and documented on the function.

This PR is in relation to conversation on PR console-rs/indicatif#808

@ugur-eren ugur-eren marked this pull request as draft June 30, 2026 17:02
@ugur-eren ugur-eren marked this pull request as ready for review June 30, 2026 17:08
Comment thread src/term.rs Outdated
Comment thread src/wasm_term.rs Outdated
@ugur-eren ugur-eren force-pushed the feat/add-is-dumb-public-function branch from 9bfbab6 to ad100af Compare July 1, 2026 12:37
@ugur-eren ugur-eren requested a review from djc July 1, 2026 12:39
@djc

djc commented Jul 1, 2026

Copy link
Copy Markdown
Member

Can you squash your existing commits and add a version bump commit?

@ugur-eren

ugur-eren commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

add a version bump commit

Should I increase patch or minor? Sorry, I don't know how cargo treats pre-1.0 releases.

@djc

djc commented Jul 1, 2026

Copy link
Copy Markdown
Member

add a version bump commit

Should I increase patch or minor? Sorry, I don't know how cargo treats pre-1.0 releases.

No worries. It should be 0.16.4, since this PR does not make any semver-incompatible changes. If this crate was post-1.0.0 we'd increase the minor version because the new API is a forward compatibility hazard.

@ugur-eren ugur-eren force-pushed the feat/add-is-dumb-public-function branch from ad100af to 86aafb0 Compare July 1, 2026 12:59
@djc djc merged commit 598eca9 into console-rs:main Jul 1, 2026
20 checks passed
@djc

djc commented Jul 1, 2026

Copy link
Copy Markdown
Member

Published 0.16.4, thanks!

kodiakhq Bot pushed a commit to pdylanross/fatigue that referenced this pull request Jul 2, 2026
Bumps console from 0.16.3 to 0.16.4.

Release notes
Sourced from console's releases.

0.16.4
What's Changed

chore: Remove redudant helper and add TermInner constructors by @​ChrisDenton in console-rs/console#284
Style::from_dotted_str ignore non-ascii by @​danjl1100 in console-rs/console#287
feat: add is_dumb public function by @​ugur-eren in console-rs/console#290




Commits

598eca9 Bump version to 0.16.4
0f22c35 feat: add is_dumb public function
1426649 Bump actions/checkout from 3 to 7
d2d89ad ignore non-ascii input in Style::from_dotted_str
6cff3e0 document current panic in Style::from_dotted_str via test cases
dd4334f Apply suggestions from clippy 1.95
586efad Remove redundant as_handle helper
be20e85 Add TermInner::new constructors
See full diff in compare view




Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

@dependabot rebase will rebase this PR
@dependabot recreate will recreate this PR, overwriting any edits that have been made to it
@dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
@dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
@dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
@dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
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.

2 participants