-
Notifications
You must be signed in to change notification settings - Fork 128
feat(cli): set terminal title to project name #988
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -525,6 +525,21 @@ fn render_header_variant( | |
| format!("{}{}", bold(&vite_plus, prefix_bold), bold(&suffix, suffix_bold)) | ||
| } | ||
|
|
||
| /// Set the terminal window title using OSC 0 escape sequence. | ||
| /// | ||
| /// Writes `ESC ] 0 ; <title> BEL` to stdout when stdout is a terminal. | ||
| /// This is a no-op when stdout is not a terminal or when running in CI. | ||
| pub fn set_terminal_title(title: &str) { | ||
| use std::io::Write; | ||
|
|
||
| if !std::io::stdout().is_terminal() || std::env::var_os("CI").is_some() { | ||
| return; | ||
| } | ||
|
|
||
| let _ = write!(std::io::stdout(), "\x1b]0;{title}\x07"); | ||
|
Comment on lines
+535
to
+539
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This emits Useful? React with 👍 / 👎. |
||
| let _ = std::io::stdout().flush(); | ||
| } | ||
|
|
||
| /// Render the Vite+ CLI header string with JS-parity coloring behavior. | ||
| #[must_use] | ||
| pub fn vite_plus_header() -> String { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will there be similar issues to #986? Under what conditions would title not be supported?