mirror of
https://github.com/orhun/systeroid
synced 2024-07-21 18:35:03 +00:00
feat(app): support KERNEL_DOCS
variable for specifying the documentation path
This commit is contained in:
parent
cc76d35916
commit
f2145cb9ca
|
@ -29,3 +29,6 @@ pub const SYSTEM_PRELOAD: &[&str] = &[
|
|||
/// Deprecated parameters to skip while listing.
|
||||
/// <https://bugzilla.redhat.com/show_bug.cgi?id=152435>
|
||||
pub const DEPRECATED_PARAMS: &[&str] = &["base_reachable_time", "retrans_time"];
|
||||
|
||||
/// Environment variable for setting the path of the Linux kernel documentation.
|
||||
pub const KERNEL_DOCS_ENV: &str = "KERNEL_DOCS";
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
use crate::style::Colors;
|
||||
use getopts::Options;
|
||||
use std::env;
|
||||
use std::path::PathBuf;
|
||||
use systeroid_core::sysctl::section::Section;
|
||||
use systeroid_core::sysctl::KERNEL_DOCS_ENV;
|
||||
|
||||
/// Help message for the arguments.
|
||||
const HELP_MESSAGE: &str = r#"
|
||||
|
@ -91,7 +93,10 @@ impl Args {
|
|||
.map_err(|e| eprintln!("error: `{}`", e))
|
||||
.ok()?
|
||||
.unwrap_or(250),
|
||||
kernel_docs: matches.opt_str("D").map(PathBuf::from),
|
||||
kernel_docs: matches
|
||||
.opt_str("D")
|
||||
.or_else(|| env::var(KERNEL_DOCS_ENV).ok())
|
||||
.map(PathBuf::from),
|
||||
section: matches.opt_str("s").map(Section::from),
|
||||
search_query: matches.opt_str("q"),
|
||||
colors: Colors::new(
|
||||
|
|
|
@ -4,7 +4,7 @@ use std::env;
|
|||
use std::path::PathBuf;
|
||||
use systeroid_core::parseit::regex::Regex;
|
||||
use systeroid_core::sysctl::display::DisplayType;
|
||||
use systeroid_core::sysctl::DEFAULT_PRELOAD;
|
||||
use systeroid_core::sysctl::{DEFAULT_PRELOAD, KERNEL_DOCS_ENV};
|
||||
|
||||
/// Help message for the arguments.
|
||||
const HELP_MESSAGE: &str = r#"
|
||||
|
@ -179,7 +179,10 @@ impl Args {
|
|||
verbose: matches.opt_present("v"),
|
||||
quiet: matches.opt_present("q"),
|
||||
write: matches.opt_present("w"),
|
||||
kernel_docs: matches.opt_str("D").map(PathBuf::from),
|
||||
kernel_docs: matches
|
||||
.opt_str("D")
|
||||
.or_else(|| env::var(KERNEL_DOCS_ENV).ok())
|
||||
.map(PathBuf::from),
|
||||
display_type,
|
||||
display_deprecated: matches.opt_present("deprecated"),
|
||||
ignore_errors: matches.opt_present("e"),
|
||||
|
|
Loading…
Reference in a new issue