mirror of
https://github.com/orhun/systeroid
synced 2024-07-22 02:45:19 +00:00
refactor(args): remove --no-color
argument
This commit is contained in:
parent
371c22ac96
commit
5e0725472b
|
@ -17,8 +17,6 @@ For more details see {bin}(8)."#;
|
|||
pub struct Args {
|
||||
/// Path of the Linux kernel documentation.
|
||||
pub kernel_docs: Option<PathBuf>,
|
||||
/// Disable colored output.
|
||||
pub no_color: bool,
|
||||
/// Parameter to explain.
|
||||
pub param_to_explain: Option<String>,
|
||||
/// Parameter names.
|
||||
|
@ -34,7 +32,6 @@ impl Args {
|
|||
opts.optflag("a", "all", "display all variables");
|
||||
opts.optflag("A", "", "alias of -a");
|
||||
opts.optflag("X", "", "alias of -a");
|
||||
opts.optflag("", "no-color", "disable colored output");
|
||||
opts.optopt(
|
||||
"",
|
||||
"explain",
|
||||
|
@ -73,7 +70,6 @@ impl Args {
|
|||
} else {
|
||||
Some(Args {
|
||||
kernel_docs: matches.opt_str("d").map(PathBuf::from),
|
||||
no_color: matches.opt_present("no-color"),
|
||||
param_to_explain: matches.opt_str("explain"),
|
||||
param_names: matches.free,
|
||||
})
|
||||
|
|
|
@ -9,6 +9,7 @@ pub mod args;
|
|||
|
||||
use crate::app::App;
|
||||
use crate::args::Args;
|
||||
use std::env;
|
||||
use systeroid_core::config::Config;
|
||||
use systeroid_core::error::Result;
|
||||
use systeroid_core::sysctl::Sysctl;
|
||||
|
@ -16,7 +17,7 @@ use systeroid_core::sysctl::Sysctl;
|
|||
/// Runs `systeroid`.
|
||||
pub fn run(args: Args) -> Result<()> {
|
||||
let mut config = Config::default();
|
||||
config.color.no_color = args.no_color;
|
||||
config.color.no_color = env::var("NO_COLOR").is_ok();
|
||||
let mut sysctl = Sysctl::init()?;
|
||||
|
||||
if let Some(kernel_docs) = args.kernel_docs {
|
||||
|
|
Loading…
Reference in a new issue