func getMountFolderFromFolder(folder string) (string, error) {
	for currentFolder := folder; currentFolder != ""; currentFolder = path.Dir(currentFolder) {
		info, err := os.Stat(path.Join(currentFolder, ".git"))
		if os.IsNotExist(err) {
			continue  
		}
		if err != nil {
			break
		}
		if info.IsDir() {
			return currentFolder, nil
		}
	}
	return folder, nil
}
getMountFolderFromFolder walks up the path hierarchy checking for a git repo. If found that is returned, if not the original folder is used
package devcontainers
import (
	"bufio"
	"bytes"
	"encoding/json"
	"fmt"
	"os"
	"os/exec"
	"path"
	"path/filepath"
	"sort"
	"strings"
	"github.com/stuartleeks/devcontainer-cli/internal/pkg/terminal"
	"github.com/stuartleeks/devcontainer-cli/internal/pkg/wsl"
)
type DevcontainerInfo struct {
	ContainerID      string
	ContainerName    string
	DevcontainerName string
	LocalFolderPath  string
}
const (
	listPartID                     int = 0
	listPartLocalFolder            int = 1
	listPartComposeProject         int = 2
	listPartComposeService         int = 3
	listPartComposeContainerNumber int = 4
	listPartContainerName          int = 5
)
var _ = listPartComposeContainerNumber
func ListDevcontainers() ([]DevcontainerInfo, error) {
	cmd := exec.Command("docker", "ps", "--format", "{{.ID}}|{{.Label \"vsch.local.folder\"}}|{{.Label \"com.docker.compose.project\"}}|{{.Label \"com.docker.compose.service\"}}|{{.Label \"com.docker.compose.container-number\"}}|{{.Names}}")
	output, err := cmd.Output()
	if err != nil {
		return []DevcontainerInfo{}, fmt.Errorf("Failed to read docker stdout: %v", err)
	}
	reader := bytes.NewReader(output)
	scanner := bufio.NewScanner(reader)
	if scanner == nil {
		return []DevcontainerInfo{}, fmt.Errorf("Failed to parse stdout")
	}
	devcontainers := []DevcontainerInfo{}
	for scanner.Scan() {
		line := scanner.Text()
		parts := strings.Split(line, "|")
		localPath := parts[listPartLocalFolder]
		if localPath == "" {
			continue
		}
		if wsl.HasWslPathPrefix(localPath) && wsl.IsWsl() {
			localPath, err = wsl.ConvertWindowsPathToWslPath(localPath)
			if err != nil {
				return []DevcontainerInfo{}, fmt.Errorf("error converting path: %s", err)
			}
		}
		name := parts[listPartLocalFolder]
		if name == "" {
			name = fmt.Sprintf("%s/%s", parts[listPartComposeProject], parts[listPartComposeService])
		} else {
			if index := strings.LastIndexAny(name, "/\\"); index >= 0 {
				name = name[index+1:]
			}
		}
		devcontainer := DevcontainerInfo{
			ContainerID:      parts[listPartID],
			ContainerName:    parts[listPartContainerName],
			LocalFolderPath:  localPath,
			DevcontainerName: name,
		}
		devcontainers = append(devcontainers, devcontainer)
	}
	return devcontainers, nil
}
func GetLocalFolderFromDevContainer(containerIDOrName string) (string, error) {
	cmd := exec.Command("docker", "inspect", containerIDOrName, "--format", "{{ index .Config.Labels \"vsch.local.folder\" }}")
	output, err := cmd.Output()
	if err != nil {
		return "", fmt.Errorf("Failed to read docker stdout: %v", err)
	}
	return strings.TrimSpace(string(output)), nil
}
type DockerMount struct {
	Source      string `json:"Source"`
	Destination string `json:"Destination"`
}
type SourceInfo struct {
	DevcontainerFolder string
	DockerMount        DockerMount
}