mirror of
https://github.com/Xyverle/neutuino.git
synced 2026-06-26 20:53:14 -04:00
Add terminal check in examples
This commit is contained in:
@@ -2,12 +2,15 @@
|
||||
|
||||
use neutuino::prelude::*;
|
||||
use std::{io, time::Duration};
|
||||
use std::io::IsTerminal;
|
||||
|
||||
fn print_line_style_reset(string: &str) {
|
||||
println!("{}{}{}", string, STYLE_RESET, move_cursor_to_column(0));
|
||||
}
|
||||
|
||||
fn main() -> io::Result<()> {
|
||||
assert!(io::stdout().is_terminal(), "Not running in a terminal");
|
||||
|
||||
let all_styles = format!("{STYLE_BOLD}{STYLE_ITALIC}{STYLE_UNDERLINE}");
|
||||
|
||||
enable_ansi()?;
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
|
||||
use neutuino::prelude::*;
|
||||
use std::{
|
||||
io::{self, Write},
|
||||
io::{self, IsTerminal, Write},
|
||||
thread, time,
|
||||
};
|
||||
|
||||
fn main() -> io::Result<()> {
|
||||
assert!(io::stdout().is_terminal(), "Not running in a terminal");
|
||||
|
||||
enable_ansi()?;
|
||||
|
||||
// makes the terminal raw until this value is dropped
|
||||
|
||||
Reference in New Issue
Block a user