pub mod config;
pub mod copy;
pub mod daemon;
pub mod deps;
pub mod device;
pub mod error;
pub mod fix;
pub mod format;
pub mod hardening;
pub mod license;
pub mod mount;
pub mod runner;
pub use config::{Config, default_config_path, load_config, save_config};
pub use device::Volume;
pub use error::{ConfigError, Error, ExitCode, Result};
pub use hardening::{
install_panic_hook, install_signal_handlers, is_stdin_tty, is_stdout_tty, should_exit,
validate_device_id, validate_label, validate_mount_point,
};
pub use license::{
LicenseSummary, ThirdPartyCounts, display_path, license_file, notice_file, third_party_counts,
};
pub use runner::{RunOptions, read_line_interactive, run_expect_success, which};
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
pub const NAME: &str = "ntfs-mac";
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct DestructiveToken {
pub device_identifier: String,
pub volume_label: String,
}
impl DestructiveToken {
pub fn new(device_identifier: impl Into<String>, volume_label: impl Into<String>) -> Self {
Self {
device_identifier: device_identifier.into(),
volume_label: volume_label.into(),
}
}
pub fn confirm_phrase(&self) -> String {
if self.volume_label.is_empty() {
format!("format {}", self.device_identifier)
} else {
format!("format {} {}", self.device_identifier, self.volume_label)
}
}
pub fn validate(&self) -> crate::error::Result<()> {
if self.device_identifier.trim().is_empty() {
return Err(Error::InvalidArgument(
"device_identifier cannot be empty".into(),
));
}
Ok(())
}
}