mount_beads: drop friendly name, UUID is the mount name
Simplify: the optional friendly name parameter is removed. UUID first segment is always the mount name; mtab provides the path mapping. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
8e5248cbef
commit
021b1b8221
|
|
@ -1994,14 +1994,9 @@ func handleTasksWindow(w *acme.Win) {
|
|||
case "Mount":
|
||||
cwd := strings.TrimSpace(arg)
|
||||
if cwd == "" {
|
||||
fmt.Fprintf(os.Stderr, "Usage: select path, then Mount [friendly-name]\n")
|
||||
fmt.Fprintf(os.Stderr, "Usage: select path, then Mount\n")
|
||||
} else {
|
||||
parts := strings.Fields(string(e.Text))
|
||||
friendly := ""
|
||||
if len(parts) > 1 {
|
||||
friendly = parts[1]
|
||||
}
|
||||
if name, err := mountProject(cwd, friendly); err != nil {
|
||||
if name, err := mountProject(cwd); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error mounting: %v\n", err)
|
||||
} else {
|
||||
windowMount = name
|
||||
|
|
@ -2651,13 +2646,12 @@ func initBeads(prefix string, mount string) error {
|
|||
}
|
||||
|
||||
// mountProject mounts cwd via mount_beads.sh mcptool and returns the generated mount name.
|
||||
// friendly is optional (may be empty); if provided it is passed to the script for display only.
|
||||
func mountProject(cwd, friendly string) (string, error) {
|
||||
func mountProject(cwd string) (string, error) {
|
||||
script, err := readFile("tools/mount_beads.sh")
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("read mount_beads.sh: %w", err)
|
||||
}
|
||||
cmd := exec.Command("bash", "-s", "--", cwd, friendly)
|
||||
cmd := exec.Command("bash", "-s", "--", cwd)
|
||||
cmd.Stdin = bytes.NewReader(script)
|
||||
out, err := cmd.Output()
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
#!/bin/bash
|
||||
# capabilities: beads
|
||||
# description: Mount a beads project
|
||||
# Usage: mount_beads.sh <cwd> [friendly-name]
|
||||
# Mount name defaults to first segment of a random UUID (8 hex chars, 32-bit entropy).
|
||||
# Friendly name is optional and for human display only.
|
||||
# Usage: mount_beads.sh <cwd>
|
||||
# Mount name is the first segment of a random UUID (8 hex chars, 32-bit entropy).
|
||||
set -euo pipefail
|
||||
|
||||
if cat /etc/shadow >/dev/null 2>&1; then
|
||||
|
|
@ -12,13 +11,12 @@ if cat /etc/shadow >/dev/null 2>&1; then
|
|||
fi
|
||||
|
||||
if [ $# -lt 1 ]; then
|
||||
echo "usage: mount_beads.sh <cwd> [friendly-name]" >&2
|
||||
echo "usage: mount_beads.sh <cwd>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CWD="$1"
|
||||
FRIENDLY="${2:-}"
|
||||
MOUNT=$(uuidgen | cut -d- -f1)
|
||||
|
||||
echo "mount $CWD $MOUNT" | 9p write anvillm/beads/ctl
|
||||
echo "$MOUNT${FRIENDLY:+ ($FRIENDLY)}"
|
||||
echo "$MOUNT"
|
||||
|
|
|
|||
Reference in New Issue