Add comprehensive inline metadata documentation to all BackTunnel scripts
This commit is contained in:
@@ -1,4 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# Copyright (c) 2025 LUXIM d.o.o., Slovenia
|
||||
# Author: Matjaž Mozetič
|
||||
#
|
||||
# Name: backtunnel-access-tui
|
||||
# Summary: Minimal TUI to mount a BackTunnel share into a chosen directory.
|
||||
# Description:
|
||||
# Interactive, terminal-based helper that asks for remote, tunnel port, and mount point,
|
||||
# then invokes backtunnel-access to perform the actual sshfs mount. Defaults to mounting
|
||||
# into the selected directory; if non-empty, proposes a "backtunnel" subdirectory.
|
||||
#
|
||||
# Usage:
|
||||
# backtunnel-access-tui <selected-dir>
|
||||
#
|
||||
# Examples:
|
||||
# backtunnel-access-tui ~/Downloads
|
||||
#
|
||||
# Dependencies:
|
||||
# - bash
|
||||
# - backtunnel-access (invoked via exec at the end)
|
||||
#
|
||||
# Exit codes:
|
||||
# 0 success (exec replaces the shell on success)
|
||||
# 1 invalid usage or mountpoint not writable
|
||||
#
|
||||
# Notes:
|
||||
# - Expands leading "~" in the chosen mount point.
|
||||
# - This tool only gathers inputs; mounting is performed by backtunnel-access.
|
||||
|
||||
set -euo pipefail
|
||||
SEL_DIR="${1:-}"
|
||||
[[ -n "$SEL_DIR" ]] || { echo "Usage: backtunnel-access-tui <selected-dir>"; exit 1; }
|
||||
@@ -11,6 +40,7 @@ if [[ -d "$SEL_DIR" ]] && [[ -n "$(ls -A -- "$SEL_DIR" 2>/dev/null || true)" ]];
|
||||
DEFAULT_MP="$SEL_DIR/backtunnel"
|
||||
fi
|
||||
|
||||
# ---- Interactive prompts (with sensible defaults) ----
|
||||
read -r -p "Remote (user@host or user:host) [user@vps.example.com]: " REMOTE
|
||||
REMOTE="${REMOTE:-user@vps.example.com}"
|
||||
|
||||
@@ -34,4 +64,5 @@ fi
|
||||
echo
|
||||
echo "Running: backtunnel-access '<remote-folder>' from '$REMOTE' -p '$PORT' -m '$MP'"
|
||||
echo "Note: you'll be prompted on the remote for the exact folder (as per your workflow)."
|
||||
# Replace this process with backtunnel-access (no return to this script after exec)
|
||||
exec backtunnel-access "$MP" from "$REMOTE" -p "$PORT" -m "$MP"
|
||||
|
||||
Reference in New Issue
Block a user