func Exists(path string) bool {
	if _, err := os.Stat(path); err != nil {
		return false
	}
	return true
}
Exists whether path exists and the user has permission
package utils
import (
	"errors"
	"fmt"
	"os"
	"os/exec"
	"os/signal"
	"os/user"
	"path/filepath"
	"runtime"
	"strconv"
	"strings"
	"syscall"
	"time"
	"github.com/AlecAivazis/survey/v2"
	"github.com/AlecAivazis/survey/v2/terminal"
	"github.com/atotto/clipboard"
	"github.com/google/uuid"
	"github.com/spf13/cobra"
)
func ConfigDir() string {
	dir, err := os.UserConfigDir()
	if err != nil {
		HandleError(err, "Unable to determine configuration directory")
	}
	return dir
}
func HomeDir() string {
	dir, err := os.UserHomeDir()
	if err != nil {
		HandleError(err, "Unable to determine home directory")
	}
	return dir
}
func ParsePath(path string) (string, error) {
	if path == "" {
		return "", errors.New("Path cannot be blank")
	}
	if strings.HasPrefix(path, "~") {
		firstPath := strings.Split(path, string(filepath.Separator))[0]
		if firstPath != "~" {
			username, err := user.Current()
			if err != nil || firstPath != fmt.Sprintf("~%s", username.Username) {
				return "", fmt.Errorf("unable to parse path, please specify an absolute path (e.g. /home/%s)", path[1:])
			}
		}
		path = strings.Replace(path, firstPath, HomeDir(), 1)
	}
	absolutePath, err := filepath.Abs(filepath.Clean(path))
	if err != nil {
		return "", err
	}
	return absolutePath, nil
}