Esempio n. 1
0
File: util.go Progetto: kevbook/hk
func netrcPath() string {
	if s := os.Getenv("NETRC_PATH"); s != "" {
		return s
	}

	return filepath.Join(hkclient.HomePath(), netrcFilename)
}
Esempio n. 2
0
File: keys.go Progetto: razzius/hk
func findKeys() ([]byte, error) {
	if sshPubKeyPath != "" {
		return sshReadPubKey(sshPubKeyPath)
	}

	out, err := exec.Command("ssh-add", "-L").Output()
	if err != nil {
		return nil, err
	}
	if len(out) != 0 {
		print(string(out))
		return out, nil
	}

	key, err := sshReadPubKey(filepath.Join(hkclient.HomePath(), ".ssh", "id_rsa.pub"))
	switch err {
	case syscall.ENOENT:
		return nil, errors.New("No SSH keys found")
	case nil:
		return key, nil
	}
	return nil, err
}
Esempio n. 3
0
File: util.go Progetto: kevbook/hk
func hkHome() string {
	return filepath.Join(hkclient.HomePath(), ".hk")
}