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

Add colour to filenames and a blank link to make visually reading easier #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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: 1 addition & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ glob = "0.3.0"
serde = { version = "1.0", features = ["derive"] }
serde_yaml = "0.8"
serde_json = "1.0"
ansi_term = "0.11.0" # Version 0.11.0 already required for clap
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rust can handle different versions of the same crate being in the source tree. I'd just use the latest version 0.12. The code where you use it does not interact with anything related to clap so there is no problem.

4 changes: 3 additions & 1 deletion src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use std::{
path::Path,
rc::Rc,
};
use ansi_term::Colour::Green;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In rust its common to let rustfmt format the files before checking them in (usually editors handle this automatically). Rustfmt orders use statements alphabetically (meaning this line would be line 1).


fn app() -> App<'static, 'static> {
clap_app!(cepler =>
Expand Down Expand Up @@ -40,8 +41,9 @@ pub fn run() -> anyhow::Result<()> {
combos.dedup();
combos.reverse();
for combo in combos {
println!("");
for file in combo.iter() {
println!("# {}", file);
println!("# {}", Green.paint(file));
}
println!(
"{}",
Expand Down