Skip to content
Snippets Groups Projects
Commit fbc837c0 authored by kkawakam's avatar kkawakam
Browse files

Remove ANSI escape sequence from example if on windows

parent ac7b94f1
No related branches found
No related tags found
Loading
......@@ -4,6 +4,15 @@ use rustyline::completion::FilenameCompleter;
use rustyline::error::ReadlineError;
use rustyline::Editor;
// On unix platforms you can use ANSI escape sequences
#[cfg(unix)]
static PROMPT: &'static str = "\x1b[1;32m>>\x1b[0m ";
// Windows consoles typically don't support ANSI escape sequences out
// of the box
#[cfg(windows)]
static PROMPT: &'static str = ">> ";
fn main() {
let c = FilenameCompleter::new();
let mut rl = Editor::new();
......@@ -12,7 +21,7 @@ fn main() {
println!("No previous history.");
}
loop {
let readline = rl.readline("\x1b[1;32m>>\x1b[0m ");
let readline = rl.readline(PROMPT);
match readline {
Ok(line) => {
rl.add_history_entry(&line);
......
asdadsasddsdfasdfasdfsfds
adsdsfafasdfasdfasdf
af
ls
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment