1use std::time::Duration;
2
3use async_tty::commands::cursor::{CursorDown, CursorPosition, CursorUp};
4use tokio::{io::AsyncWriteExt, time::sleep};
5
6#[tokio::main]
7async fn main() -> color_eyre::Result<()> {
8 color_eyre::install()?;
9 let mut terminal = async_tty::Terminal::new()?;
10 terminal.switch_to_alternate_screen().await?;
11 let cursor_movements = format!(
12 "{}at 20,10{}up 1{}down 2",
13 CursorPosition {
14 row: 10,
15 column: 20,
16 },
17 CursorUp { count: 1 },
18 CursorDown { count: 2 }
19 );
20 terminal.write_all(cursor_movements.as_bytes()).await?;
21 sleep(Duration::from_secs(2)).await;
22 terminal.switch_to_main_screen().await?;
23 Ok(())
24}