use crate::{RunContext, Runnable, util::open_path};
use anyhow::{Context, Result};
use clap::Parser;
use std::{os::unix::io::AsFd, path::PathBuf};
#[derive(Parser, Debug)]
pub struct QuotaDisableCommand {
pub path: PathBuf,
}
impl Runnable for QuotaDisableCommand {
fn run(&self, _ctx: &RunContext) -> Result<()> {
let file = open_path(&self.path)?;
btrfs_uapi::quota::quota_disable(file.as_fd()).with_context(|| {
format!("failed to disable quota on '{}'", self.path.display())
})?;
println!("quota disabled on '{}'", self.path.display());
Ok(())
}
}