From c71c08ac874639498cd94604565584b14350a2d2 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 7 Jun 2026 23:22:22 +0000 Subject: [PATCH] manage_users.sh: show available folders before link prompt List top-level directories from /srv so the user knows what to type without having to guess. Subdirs (e.g. documents/shared) still work. Skip link prompt when scope is / (user already has full access). https://claude.ai/code/session_01UZus2Q9gNTfUdqSMrhuX29 --- tools/manage_users.sh | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/tools/manage_users.sh b/tools/manage_users.sh index 809a28d..f46ee52 100644 --- a/tools/manage_users.sh +++ b/tools/manage_users.sh @@ -184,8 +184,18 @@ prompt_add_links() { docker exec "$_c" mkdir -p "$_scope_dir" >/dev/null 2>&1 || true echo - echo " Type folder names as they appear in FileBrowser — blank line when done." - echo " Examples: music photos documents/shared" + # Show top-level folders so the user knows what's available + local _avail + _avail=$(docker exec "$_c" find /srv -maxdepth 1 -mindepth 1 -type d \ + -not -name ".*" 2>/dev/null | sed 's|^/srv/||' | sort | xargs echo) || true + if [[ -n "$_avail" ]]; then + echo " Available folders: $_avail" + echo " Subdirectories also work, e.g.: documents/shared" + else + echo " (No top-level folders found in FileBrowser root)" + fi + echo + echo " Type a folder name to add — blank line when done." echo while true; do @@ -340,8 +350,8 @@ cmd_add() { echo ok "User '$_username' created | scope: $_scope | admin: $_is_admin" - # Offer to add linked directories inline - if command -v docker &>/dev/null; then + # Offer linked directories (pointless if scope is already /) + if command -v docker &>/dev/null && [[ "$_scope" != "/" ]]; then local _do_links="" read -r -p " Add linked directories for '$_username'? [y/N]: " _do_links if [[ "${_do_links,,}" == "y" ]]; then