Add log variable to justfile (#621)

Allows logging to be controlled with, for example:

    just log=trace run
This commit is contained in:
Casey Rodarmor 2020-03-31 00:00:05 -07:00 committed by GitHub
parent 1f8c230512
commit f73de24fd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 15 deletions

View File

@ -15,20 +15,20 @@ help4help2man = []
summary = [] summary = []
[dependencies] [dependencies]
ansi_term = "0.12.0" ansi_term = "0.12.0"
atty = "0.2.0" atty = "0.2.0"
clap = "2.33.0" clap = "2.33.0"
derivative = "2.0.0" derivative = "2.0.0"
dotenv = "0.15.0" dotenv = "0.15.0"
edit-distance = "2.0.0" edit-distance = "2.0.0"
env_logger = "0.7.0" env_logger = "0.7.0"
lazy_static = "1.0.0" lazy_static = "1.0.0"
libc = "0.2.0" libc = "0.2.0"
log = "0.4.4" log = "0.4.4"
snafu = "0.6.0" snafu = "0.6.0"
target = "1.0.0" target = "1.0.0"
tempfile = "3.0.0" tempfile = "3.0.0"
unicode-width = "0.1.0" unicode-width = "0.1.0"
[dependencies.ctrlc] [dependencies.ctrlc]
version = "3.1.1" version = "3.1.1"

View File

@ -10,12 +10,19 @@ bt := '0'
export RUST_BACKTRACE := bt export RUST_BACKTRACE := bt
log := "warn"
export JUST_LOG := log
test: test:
cargo test cargo test
fuzz: fuzz:
cargo +nightly fuzz run fuzz-compiler cargo +nightly fuzz run fuzz-compiler
run:
cargo run
@spam: @spam:
{ \ { \
figlet test; \ figlet test; \

View File

@ -29,7 +29,7 @@ pub(crate) use crate::{node::Node, tree::Tree};
pub(crate) use derivative::Derivative; pub(crate) use derivative::Derivative;
pub(crate) use edit_distance::edit_distance; pub(crate) use edit_distance::edit_distance;
pub(crate) use libc::EXIT_FAILURE; pub(crate) use libc::EXIT_FAILURE;
pub(crate) use log::warn; pub(crate) use log::{info, warn};
pub(crate) use snafu::{ResultExt, Snafu}; pub(crate) use snafu::{ResultExt, Snafu};
pub(crate) use unicode_width::UnicodeWidthChar; pub(crate) use unicode_width::UnicodeWidthChar;

View File

@ -13,6 +13,7 @@ pub fn run() -> Result<(), i32> {
let app = Config::app(); let app = Config::app();
info!("Parsing command line arguments…");
let matches = app.get_matches(); let matches = app.get_matches();
let config = Config::from_matches(&matches).eprint(Color::auto())?; let config = Config::from_matches(&matches).eprint(Color::auto())?;