Init commit
This commit is contained in:
29
src/subcommands/test.rs
Normal file
29
src/subcommands/test.rs
Normal file
@@ -0,0 +1,29 @@
|
||||
use clap::Parser;
|
||||
use std::fs;
|
||||
use crate::subcommands::Subcommand;
|
||||
|
||||
use super::CmdResult;
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
pub struct TestSubcommand {
|
||||
path: String
|
||||
}
|
||||
|
||||
impl Subcommand for TestSubcommand {
|
||||
fn run(&self) -> CmdResult {
|
||||
let metadata = match fs::metadata(self.path.clone()) {
|
||||
Ok(metadata) => metadata,
|
||||
_ => return Err(String::from("")),
|
||||
};
|
||||
|
||||
let mtime = match metadata.modified() {
|
||||
Ok(mtime) => mtime,
|
||||
_ => return Err(String::from("")),
|
||||
};
|
||||
|
||||
// mtime
|
||||
println!("{mtime:?}");
|
||||
|
||||
Ok(String::from(""))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user