Revert "10.2.0 release " (#215)

Revert "10.2.0 release  (#213)"

This reverts commit 13076fcef6.
This commit is contained in:
Thomas Schönauer
2022-11-23 15:23:00 +00:00
committed by GitHub
parent 13076fcef6
commit bd34a3bcd4
43 changed files with 887 additions and 1579 deletions

View File

@@ -1,24 +1,21 @@
#![allow(dead_code)]
use anyhow::Context;
use anyhow::Result;
use clap::{ArgEnum, Parser};
use directories::BaseDirs;
use log::debug;
use regex::Regex;
use serde::Deserialize;
use std::collections::BTreeMap;
use std::fs::write;
use std::path::PathBuf;
use std::process::Command;
use std::{env, fs};
use clap::{ArgEnum, Parser};
use color_eyre::eyre;
use color_eyre::eyre::Context;
use color_eyre::eyre::Result;
use directories::BaseDirs;
use regex::Regex;
use serde::Deserialize;
use strum::{EnumIter, EnumString, EnumVariantNames, IntoEnumIterator};
use tracing::debug;
use sys_info::hostname;
use which_crate::which;
use crate::command::CommandExt;
use super::utils::{editor, hostname};
use super::utils::editor;
pub static EXAMPLE_CONFIG: &str = include_str!("../config.example.toml");
@@ -351,12 +348,12 @@ impl ConfigFile {
};
let contents = fs::read_to_string(&config_path).map_err(|e| {
tracing::error!("Unable to read {}", config_path.display());
log::error!("Unable to read {}", config_path.display());
e
})?;
let mut result: Self = toml::from_str(&contents).map_err(|e| {
tracing::error!("Failed to deserialize {}", config_path.display());
log::error!("Failed to deserialize {}", config_path.display());
e
})?;
@@ -392,8 +389,9 @@ impl ConfigFile {
Command::new(command)
.args(args)
.arg(config_path)
.status_checked()
.context("Failed to open configuration file editor")
.spawn()
.and_then(|mut p| p.wait())?;
Ok(())
}
}
@@ -441,7 +439,7 @@ pub struct CommandLineArgs {
#[clap(long = "env", value_name = "NAME=VALUE", multiple_values = true)]
env: Vec<String>,
/// Output debug logs. Alias for `--log-filter debug`.
/// Output logs
#[clap(short = 'v', long = "verbose")]
pub verbose: bool,
@@ -479,12 +477,6 @@ pub struct CommandLineArgs {
/// Show the reason for skipped steps
#[clap(long = "show-skipped")]
show_skipped: bool,
/// Tracing filter directives.
///
/// See: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/struct.EnvFilter.html
#[clap(long, default_value = "info")]
pub log_filter: String,
}
impl CommandLineArgs {
@@ -499,14 +491,6 @@ impl CommandLineArgs {
pub fn env_variables(&self) -> &Vec<String> {
&self.env
}
pub fn tracing_filter_directives(&self) -> String {
if self.verbose {
"debug".into()
} else {
self.log_filter.clone()
}
}
}
/// Represents the application configuration
@@ -530,11 +514,11 @@ impl Config {
ConfigFile::read(base_dirs, opt.config.clone()).unwrap_or_else(|e| {
// Inform the user about errors when loading the configuration,
// but fallback to the default config to at least attempt to do something
tracing::error!("failed to load configuration: {}", e);
log::error!("failed to load configuration: {}", e);
ConfigFile::default()
})
} else {
tracing::debug!("Configuration directory {} does not exist", config_directory.display());
log::debug!("Configuration directory {} does not exist", config_directory.display());
ConfigFile::default()
};
@@ -649,7 +633,7 @@ impl Config {
}
/// Extra Tmux arguments
pub fn tmux_arguments(&self) -> eyre::Result<Vec<String>> {
pub fn tmux_arguments(&self) -> anyhow::Result<Vec<String>> {
let args = &self.config_file.tmux_arguments.as_deref().unwrap_or_default();
shell_words::split(args)
// The only time the parse failed is in case of a missing close quote.