From eff6dafa77049ad122584ea98aa3f4f82ae04ff5 Mon Sep 17 00:00:00 2001 From: DragonSlayer_14 Date: Sun, 20 Sep 2026 16:55:24 +0200 Subject: [PATCH] =?UTF-8?q?Fix:=20Klarere=20Feldbezeichnung=20f=C3=BCr=20'?= =?UTF-8?q?share'/Export-Pfad=20in=20'drive=20add'/'edit'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Der generische Prompt-/Hilfetext "Local/Cloud share/export path" war unabhängig vom gewählten Mount-Typ identisch, obwohl das Feld inhaltlich je nach Backend etwas anderes ist (SMB-Freigabename, NFS-Export-Pfad, WebDAV-URL-Pfad). share_field_label() wählt jetzt passend zum bereits gewählten local_kind/cloud_kind einen eindeutigen Text mit Beispiel. Co-Authored-By: Claude Sonnet 5 --- src/cli/drive.rs | 40 ++++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/src/cli/drive.rs b/src/cli/drive.rs index e9e1ef5..e8cea97 100644 --- a/src/cli/drive.rs +++ b/src/cli/drive.rs @@ -56,6 +56,8 @@ pub struct DriveArgs { local_ip: Option, #[arg(long, conflicts_with = "local_ip")] local_mac: Option, + /// Meaning depends on '--local-kind': the SMB share name (e.g. 'media'), the NFS export + /// path (e.g. '/export/media'), or the WebDAV URL path (e.g. '/remote.php/dav/files/user'). #[arg(long)] local_share: Option, #[arg(long)] @@ -72,6 +74,8 @@ pub struct DriveArgs { cloud_kind: Option, #[arg(long)] cloud_host: Option, + /// Meaning depends on '--cloud-kind': the SMB share name (e.g. 'media'), the NFS export + /// path (e.g. '/export/media'), or the WebDAV URL path (e.g. '/remote.php/dav/files/user'). #[arg(long)] cloud_share: Option, #[arg(long)] @@ -90,6 +94,18 @@ pub struct DriveArgs { non_interactive: bool, } +/// Beschriftet das `share`-Feld abhängig vom bereits gewählten Mount-Typ statt des +/// generischen "share/export path" - die drei Backends legen dort inhaltlich verschiedene +/// Dinge ab (SMB-Freigabename, NFS-Export-Pfad, WebDAV-URL-Pfad), siehe +/// `mount::target::format_source`. +fn share_field_label(kind: MountKind, prefix: &str) -> String { + match kind { + MountKind::WebDav => format!("{prefix} WebDAV path (e.g. '/remote.php/dav/files/user')"), + MountKind::Smb => format!("{prefix} share name (e.g. 'media')"), + MountKind::Nfs => format!("{prefix} export path (e.g. '/export/media')"), + } +} + pub async fn run(action: DriveAction) -> anyhow::Result<()> { match action { DriveAction::Add(args) => add(args).await, @@ -166,8 +182,14 @@ async fn add(args: DriveArgs) -> anyhow::Result<()> { let local_kind = resolve_kind(args.local_kind, None, "Local mount type", ni)?; let local_address = resolve_local_address(args.local_ip, args.local_mac, None, ni)?; - let local_share = resolve_field(args.local_share, None, "Local share/export path", ni, true)? - .expect("required"); + let local_share = resolve_field( + args.local_share, + None, + &share_field_label(local_kind, "Local"), + ni, + true, + )? + .expect("required"); let local_password_flag = read_password_flag(args.local_password, args.local_password_stdin)?; let (local_username, local_password) = resolve_credentials( local_kind, @@ -181,8 +203,14 @@ async fn add(args: DriveArgs) -> anyhow::Result<()> { let cloud_kind = resolve_kind(args.cloud_kind, None, "Cloud mount type", ni)?; let cloud_host = resolve_field(args.cloud_host, None, "Cloud server address/URL", ni, true)? .expect("required"); - let cloud_share = resolve_field(args.cloud_share, None, "Cloud share/export path", ni, true)? - .expect("required"); + let cloud_share = resolve_field( + args.cloud_share, + None, + &share_field_label(cloud_kind, "Cloud"), + ni, + true, + )? + .expect("required"); let cloud_password_flag = read_password_flag(args.cloud_password, args.cloud_password_stdin)?; let (cloud_username, cloud_password) = resolve_credentials( cloud_kind, @@ -272,7 +300,7 @@ async fn edit(id: &str, args: DriveArgs) -> anyhow::Result<()> { let local_share = resolve_field( args.local_share, Some(&existing.local.share), - "Local share/export path", + &share_field_label(local_kind, "Local"), ni, true, )? @@ -307,7 +335,7 @@ async fn edit(id: &str, args: DriveArgs) -> anyhow::Result<()> { let cloud_share = resolve_field( args.cloud_share, Some(&existing.cloud.share), - "Cloud share/export path", + &share_field_label(cloud_kind, "Cloud"), ni, true, )?