Fix code quality: trailing whitespace, unused imports, clippy warnings
- Fix trailing whitespace in kex.rs and s3.rs - Add missing KexProposal import in kex_complete.rs - Auto-fix clippy warnings across all crates - All 153 tests pass
This commit is contained in:
@@ -22,21 +22,25 @@ pub enum MountCommand {
|
||||
|
||||
pub fn handle_mount_command(cmd: MountCommand) -> anyhow::Result<()> {
|
||||
match cmd {
|
||||
MountCommand::Attach { type_, server, path } => {
|
||||
MountCommand::Attach {
|
||||
type_,
|
||||
server,
|
||||
path,
|
||||
} => {
|
||||
use std::process::Command;
|
||||
|
||||
|
||||
println!("Mounting {} from {} to {}", type_, server, path);
|
||||
|
||||
|
||||
if type_ == "nfs" {
|
||||
let mount_point = std::path::Path::new(&path);
|
||||
std::fs::create_dir_all(mount_point)?;
|
||||
|
||||
|
||||
let nfs_path = format!("{}:{}", server, path);
|
||||
|
||||
|
||||
let status = Command::new("mount")
|
||||
.args(["-t", "nfs", &nfs_path, &path])
|
||||
.status()?;
|
||||
|
||||
|
||||
if status.success() {
|
||||
println!("✓ NFS mounted: {} to {}", nfs_path, path);
|
||||
} else {
|
||||
@@ -45,31 +49,32 @@ pub fn handle_mount_command(cmd: MountCommand) -> anyhow::Result<()> {
|
||||
} else if type_ == "smb" {
|
||||
let mount_point = std::path::Path::new(&path);
|
||||
std::fs::create_dir_all(mount_point)?;
|
||||
|
||||
|
||||
let smb_path = format!("//{}", server);
|
||||
|
||||
|
||||
let status = Command::new("mount")
|
||||
.args(["-t", "smbfs", &smb_path, &path])
|
||||
.status()?;
|
||||
|
||||
|
||||
if status.success() {
|
||||
println!("✓ SMB mounted: {} to {}", smb_path, path);
|
||||
} else {
|
||||
return Err(anyhow::anyhow!("SMB mount failed"));
|
||||
}
|
||||
} else {
|
||||
return Err(anyhow::anyhow!("Unknown mount type: {}. Use 'nfs' or 'smb'", type_));
|
||||
return Err(anyhow::anyhow!(
|
||||
"Unknown mount type: {}. Use 'nfs' or 'smb'",
|
||||
type_
|
||||
));
|
||||
}
|
||||
}
|
||||
MountCommand::Detach { path } => {
|
||||
use std::process::Command;
|
||||
|
||||
|
||||
println!("Unmounting {}", path);
|
||||
|
||||
let status = Command::new("umount")
|
||||
.arg(&path)
|
||||
.status()?;
|
||||
|
||||
|
||||
let status = Command::new("umount").arg(&path).status()?;
|
||||
|
||||
if status.success() {
|
||||
println!("✓ Unmounted: {}", path);
|
||||
} else {
|
||||
@@ -78,14 +83,13 @@ pub fn handle_mount_command(cmd: MountCommand) -> anyhow::Result<()> {
|
||||
}
|
||||
MountCommand::List => {
|
||||
use std::process::Command;
|
||||
|
||||
|
||||
println!("Listing mounted storage");
|
||||
|
||||
let output = Command::new("mount")
|
||||
.output()?;
|
||||
|
||||
|
||||
let output = Command::new("mount").output()?;
|
||||
|
||||
let mounts = String::from_utf8_lossy(&output.stdout);
|
||||
|
||||
|
||||
println!("=== Mounted Filesystems ===");
|
||||
for line in mounts.lines() {
|
||||
if line.contains("nfs") || line.contains("smbfs") || line.contains("fuse") {
|
||||
@@ -95,4 +99,4 @@ pub fn handle_mount_command(cmd: MountCommand) -> anyhow::Result<()> {
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user