@@ -51,39 +51,6 @@ pub fn is_markdown() -> bool {
5151/// The global shell instance.
5252static GLOBAL_SHELL : OnceLock < Mutex < Shell > > = OnceLock :: new ( ) ;
5353
54- /// Terminal width.
55- pub enum TtyWidth {
56- /// Not a terminal, or could not determine size.
57- NoTty ,
58- /// A known width.
59- Known ( usize ) ,
60- /// A guess at the width.
61- Guess ( usize ) ,
62- }
63-
64- impl TtyWidth {
65- /// Returns the width of the terminal from the environment, if known.
66- pub fn get ( ) -> Self {
67- // use stderr
68- #[ cfg( unix) ]
69- let opt = terminal_size:: terminal_size_of ( std:: io:: stderr ( ) ) ;
70- #[ cfg( not( unix) ) ]
71- let opt = terminal_size:: terminal_size ( ) ;
72- match opt {
73- Some ( ( w, _) ) => Self :: Known ( w. 0 as usize ) ,
74- None => Self :: NoTty ,
75- }
76- }
77-
78- /// Returns the width used by progress bars for the tty.
79- pub fn progress_max_width ( & self ) -> Option < usize > {
80- match * self {
81- Self :: NoTty => None ,
82- Self :: Known ( width) | Self :: Guess ( width) => Some ( width) ,
83- }
84- }
85- }
86-
8754#[ derive( Debug , Default , Clone , Copy , PartialEq ) ]
8855/// The requested output mode.
8956pub enum OutputMode {
@@ -296,14 +263,6 @@ impl Shell {
296263 !self . needs_clear ( )
297264 }
298265
299- /// Returns the width of the terminal in spaces, if any.
300- pub fn err_width ( & self ) -> TtyWidth {
301- match self . output {
302- ShellOut :: Stream { stderr_tty : true , .. } => TtyWidth :: get ( ) ,
303- _ => TtyWidth :: NoTty ,
304- }
305- }
306-
307266 /// Gets the output format of the shell.
308267 pub fn output_format ( & self ) -> OutputFormat {
309268 self . output_format
0 commit comments