| 1 | use clap::{ArgAction, Parser}; |
| 2 | use sysinfo::Disks; |
| 3 | |
| 4 | #[derive(Parser, Debug)] |
| 5 | #[command(version, about, long_about = None)] |
| 6 | pub struct Args { |
| 7 | #[arg(short = 'O', long, action = ArgAction::SetTrue)] |
| 8 | /// output all columns |
| 9 | pub output_all: bool, |
| 10 | |
| 11 | #[arg(short, long)] |
| 12 | /// output columns see (--list-columns) |
| 13 | pub output: Option<String> |
| 14 | } |
| 15 | |
| 16 | #[derive(Debug)] |
| 17 | pub struct App { |
| 18 | pub disks: Disks, |
| 19 | pub args: Args |
| 20 | } |
| 21 | |
| 22 | impl App { |
| 23 | pub fn new(disks: Disks) -> Self { |
| 24 | let args = Args::parse(); |
| 25 | |
| 26 | Self { disks, args } |
| 27 | } |
| 28 | } |
