Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove ansi_term and colored output #20

Merged
merged 1 commit into from
May 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ publish = false


[dependencies]
ansi_term = "^0.9.0"
clap = "^2.24.2"
globset = "^0.2.0"
ignore = "^0.2.0"
Expand Down
19 changes: 5 additions & 14 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
extern crate ansi_term;
#[macro_use]
extern crate clap;
extern crate globset;
Expand All @@ -24,7 +23,6 @@ enum ReturnCode {
}

fn main() {
use ansi_term::Colour::{Red, Green};
use clap::{App, Arg};
use file_utils::walk_indentex_files;
use rayon::prelude::*;
Expand Down Expand Up @@ -70,36 +68,29 @@ fn main() {
Ok(b) => b,
Err(e) => {
ret_val = ReturnCode::WalkError as i32;
println!("{}", Red.bold().paint(format!("{}", e)));
println!("{}", e);
Vec::new()
}
}
} else {
ret_val = ReturnCode::FileTypeError as i32;
println!("{}",
Red.bold().paint(format!("Error: path '{}' is neither a file nor a directory",
path.display())));
println!("Error: path '{}' is neither a file nor a directory", path.display());
Vec::new()
};

let ret_val_transpilation = batch.par_iter()
.map(|p| match transpile_file(&p, &options) {
Ok(_) => {
if verbose {
println!("Transpiling file '{}'... {}",
p.display(),
Green.paint("ok"));
println!("Transpiling file '{}'... ok", p.display());
}
ReturnCode::Ok
}
Err(e) => {
if verbose {
println!("Transpiling file '{}'... {}",
p.display(),
Red.paint("failed"));
println!("Transpiling file '{}'... failed", p.display());
}
println!("{}",
Red.bold().paint(format!("Could not transpile '{}': {}", p.display(), e)));
println!("Could not transpile '{}': {}", p.display(), e);
ReturnCode::TranspilationError
}
} as i32)
Expand Down