goobits-repos 2.1.0

Fast Git repository management and synchronization tool
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! Terminal utilities for title setting and output management

use std::io::Write;

/// Sets the terminal title to the specified text
pub fn set_terminal_title(title: &str) {
    // ANSI escape sequence to set terminal title
    print!("\x1b]0;{}\x07", title);
}

/// Sets the terminal title and ensures it's flushed to the terminal
pub fn set_terminal_title_and_flush(title: &str) {
    set_terminal_title(title);
    std::io::stdout().flush().expect("Failed to flush stdout when setting terminal title - this indicates a terminal or I/O issue");
}