mirror of
https://github.com/orhun/systeroid
synced 2024-10-06 23:59:10 +00:00
feat(args): add --no-docs
flag for tui
This commit is contained in:
parent
fed7612caf
commit
e8c052e730
|
@ -18,6 +18,8 @@ pub struct Args {
|
|||
pub tick_rate: u64,
|
||||
/// Path of the Linux kernel documentation.
|
||||
pub kernel_docs: Option<PathBuf>,
|
||||
/// Do not parse/show Linux kernel documentation.
|
||||
pub no_docs: bool,
|
||||
}
|
||||
|
||||
impl Args {
|
||||
|
@ -36,6 +38,7 @@ impl Args {
|
|||
"set the path of the kernel documentation",
|
||||
"<path>",
|
||||
);
|
||||
opts.optflag("n", "no-docs", "do not show the kernel documentation");
|
||||
opts.optflag("h", "help", "display this help and exit");
|
||||
opts.optflag("V", "version", "output version information and exit");
|
||||
opts
|
||||
|
@ -67,6 +70,7 @@ impl Args {
|
|||
.ok()?
|
||||
.unwrap_or(250),
|
||||
kernel_docs: matches.opt_str("D").map(PathBuf::from),
|
||||
no_docs: matches.opt_present("n"),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,9 @@ pub fn run<Output: Write>(args: Args, output: Output) -> Result<()> {
|
|||
terminal.clear()?;
|
||||
let event_handler = EventHandler::new(args.tick_rate);
|
||||
let mut sysctl = Sysctl::init(Config::default())?;
|
||||
sysctl.update_docs_from_cache(args.kernel_docs.as_ref(), &Cache::init()?)?;
|
||||
if !args.no_docs {
|
||||
sysctl.update_docs_from_cache(args.kernel_docs.as_ref(), &Cache::init()?)?;
|
||||
}
|
||||
let mut app = App::new(&mut sysctl);
|
||||
while app.running {
|
||||
terminal.draw(|frame| ui::render(frame, &mut app))?;
|
||||
|
|
Loading…
Reference in a new issue