Clean up due to removing pubs
This commit is contained in:
parent
324fbe9055
commit
eafbc9a77b
|
@ -1,33 +1,18 @@
|
|||
use clap::{crate_version, value_t, values_t, App, Arg};
|
||||
use log::LevelFilter;
|
||||
use std::{
|
||||
ffi::OsString,
|
||||
path::{PathBuf, MAIN_SEPARATOR},
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
use crate::config::{Config, ConfigBuilder};
|
||||
use crate::run::OnBusyUpdate;
|
||||
use crate::{error, Shell};
|
||||
use watchexec::{
|
||||
config::{Config, ConfigBuilder},
|
||||
error,
|
||||
run::OnBusyUpdate,
|
||||
Shell,
|
||||
};
|
||||
|
||||
pub fn get_args() -> error::Result<(Config, LevelFilter)> {
|
||||
get_args_impl(None::<&[&str]>)
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn get_args_from<I, T>(from: I) -> error::Result<(Config, LevelFilter)>
|
||||
where
|
||||
I: IntoIterator<Item = T>,
|
||||
T: Into<OsString> + Clone,
|
||||
{
|
||||
get_args_impl(Some(from))
|
||||
}
|
||||
|
||||
fn get_args_impl<I, T>(from: Option<I>) -> error::Result<(Config, LevelFilter)>
|
||||
where
|
||||
I: IntoIterator<Item = T>,
|
||||
T: Into<OsString> + Clone,
|
||||
{
|
||||
let app = App::new("watchexec")
|
||||
.version(crate_version!())
|
||||
.about("Execute commands when watched files change")
|
||||
|
@ -142,11 +127,7 @@ where
|
|||
.short("W")
|
||||
.long("watch-when-idle"));
|
||||
|
||||
let args = match from {
|
||||
None => app.get_matches(),
|
||||
Some(i) => app.get_matches_from(i),
|
||||
};
|
||||
|
||||
let args = app.get_matches();
|
||||
let mut builder = ConfigBuilder::default();
|
||||
|
||||
let cmd: Vec<String> =
|
||||
|
|
|
@ -1,19 +1,16 @@
|
|||
use std::io::Write;
|
||||
|
||||
use watchexec::{error::Result, run};
|
||||
|
||||
mod args;
|
||||
|
||||
fn main() -> error::Result<()> {
|
||||
#[allow(deprecated)]
|
||||
fn main() -> Result<()> {
|
||||
let (args, loglevel) = args::get_args()?;
|
||||
init_logger(loglevel);
|
||||
watchexec::run(args)
|
||||
}
|
||||
|
||||
fn init_logger(level: log::LevelFilter) {
|
||||
let mut log_builder = env_logger::Builder::new();
|
||||
|
||||
log_builder
|
||||
env_logger::Builder::new()
|
||||
.format(|buf, r| writeln!(buf, "*** {}", r.args()))
|
||||
.filter(None, level)
|
||||
.filter(None, loglevel)
|
||||
.init();
|
||||
|
||||
run(args)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue