about summary refs log tree commit diff stats
path: root/yt/src/download/progress_hook.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--yt/src/download/progress_hook.rs16
1 files changed, 4 insertions, 12 deletions
diff --git a/yt/src/download/progress_hook.rs b/yt/src/download/progress_hook.rs
index 65156e7..db58225 100644
--- a/yt/src/download/progress_hook.rs
+++ b/yt/src/download/progress_hook.rs
@@ -7,7 +7,10 @@ use bytes::Bytes;
 use log::{Level, log_enabled};
 use yt_dlp::mk_python_function;
 
-use crate::select::selection_file::duration::MaybeDuration;
+use crate::{
+    ansi_escape_codes::{clear_whole_line, move_to_col},
+    select::selection_file::duration::MaybeDuration,
+};
 
 // #[allow(clippy::too_many_lines)]
 // #[allow(clippy::missing_panics_doc)]
@@ -26,17 +29,6 @@ pub fn progress_hook(
         return Ok(());
     }
 
-    // ANSI ESCAPE CODES Wrappers {{{
-    // see: https://en.wikipedia.org/wiki/ANSI_escape_code#Control_Sequence_Introducer_commands
-    const CSI: &str = "\x1b[";
-    fn clear_whole_line() {
-        eprint!("{CSI}2K");
-    }
-    fn move_to_col(x: usize) {
-        eprint!("{CSI}{x}G");
-    }
-    // }}}
-
     macro_rules! get {
         (@interrogate $item:ident, $type_fun:ident, $get_fun:ident, $name:expr) => {{
             let a = $item.get($name).expect(concat!(