INNER CODE UNIT · Go
expandPath
umputun/spot · cmd/spot/main.go:521
func expandPath(path string) (string, error) {
if strings.HasPrefix(path, "~") {
usr, err := userProvider.Current()
if err != nil {
return "", err
}
home := usr.HomeDir
return filepath.Join(home, path[1:]), nil
}
return path, nil
}
// setAdHocSSH updates playbook with ssh user and key from cli the os
func setAdHocSSH(opts options, pbook *config.PlayBook) (*config.PlayBook, error) {
if opts.SSHUser == "" {
u, err := userProvider.Current()
if err != nil {
return nil, fmt.Errorf("can't get current user: %w", err)