|
|
@ -52,11 +52,22 @@ cfg_if!{
|
|
|
|
|
|
|
|
|
|
|
|
type Pointer = *const Never;
|
|
|
|
type Pointer = *const Never;
|
|
|
|
|
|
|
|
|
|
|
|
fn install() -> eyre::Result<()>
|
|
|
|
/// Install things and get other things
|
|
|
|
|
|
|
|
fn install() -> eyre::Result<(progress::logging::Level,)>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
let logv = std::env::var("RUST_LOG");
|
|
|
|
color_eyre::install()?;
|
|
|
|
color_eyre::install()?;
|
|
|
|
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
let lv = match logv {
|
|
|
|
|
|
|
|
Ok(log) if log.trim().len() !=0 => log.parse().unwrap_or_else(|e| {
|
|
|
|
|
|
|
|
let def = Default::default();
|
|
|
|
|
|
|
|
eprintln!("Failed to parse logging level, using default `{:?}`: {}", def, e);
|
|
|
|
|
|
|
|
def
|
|
|
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
_ => Default::default(),
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ok((lv,))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Currently a mock impl for process
|
|
|
|
/// Currently a mock impl for process
|
|
|
@ -113,7 +124,7 @@ async fn validate_config(config: config::Config) -> eyre::Result<config::Config>
|
|
|
|
async fn begin() -> eyre::Result<i32>
|
|
|
|
async fn begin() -> eyre::Result<i32>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
use futures::prelude::*;
|
|
|
|
use futures::prelude::*;
|
|
|
|
install()?;
|
|
|
|
let (log_level,) = install()?;
|
|
|
|
{
|
|
|
|
{
|
|
|
|
let (progress, progress_join) = {
|
|
|
|
let (progress, progress_join) = {
|
|
|
|
let bar = termprogress::progress::Bar::new(50);
|
|
|
|
let bar = termprogress::progress::Bar::new(50);
|
|
|
@ -132,11 +143,8 @@ async fn begin() -> eyre::Result<i32>
|
|
|
|
let state = {
|
|
|
|
let state = {
|
|
|
|
use progress::logging;
|
|
|
|
use progress::logging;
|
|
|
|
let mut logger = logging::Logger::new(progress,
|
|
|
|
let mut logger = logging::Logger::new(progress,
|
|
|
|
logging::Level::Info); //TODO: Get level from env var
|
|
|
|
log_level);
|
|
|
|
|
|
|
|
|
|
|
|
//let task_id = progress.send_command_and_downcast(progress::CommandKind::AddTask("Task name".to_owned())).await?.unwrap();
|
|
|
|
|
|
|
|
//progress.send_command_and_wait(progress::CommandKind::AddTask("Task 2 name".to_owned())).await?;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let state = Arc::new(state::State::new(validate_config(config::Config::default()).await
|
|
|
|
let state = Arc::new(state::State::new(validate_config(config::Config::default()).await
|
|
|
|
.wrap_err(eyre!("Failed to validate config"))?,
|
|
|
|
.wrap_err(eyre!("Failed to validate config"))?,
|
|
|
|
logger.clone()));
|
|
|
|
logger.clone()));
|
|
|
@ -154,7 +162,6 @@ async fn begin() -> eyre::Result<i32>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
args::usage();
|
|
|
|
args::usage();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//progress.send_command_and_wait(progress::CommandKind::RemoveTask(task_id)).await?;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Cleanup deferred in new `async` block to drop `state` before this block is ran.
|
|
|
|
//Cleanup deferred in new `async` block to drop `state` before this block is ran.
|
|
|
|
async move {
|
|
|
|
async move {
|
|
|
|