INNER CODE UNIT · Go

sshUser

umputun/spot · cmd/spot/main.go:507

func sshUser(sshUser string, pbook *config.PlayBook) (string, error) {
	if sshUser == "" && pbook != nil && pbook.User != "" { // no user provided in cli, use playbook's user
		sshUser = pbook.User
	}
	if sshUser == "" { // no user provided in cli or playbook
		u, err := userProvider.Current()
		if err != nil {
			return "", fmt.Errorf("can't get current user: %w", err)
		}
		sshUser = u.Username
	}
	return sshUser, nil
}

func expandPath(path string) (string, error) {
	if strings.HasPrefix(path, "~") {
		usr, err := userProvider.Current()
		if err != nil {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…