private static bool GetSSHKeys(out string location) { Dialogue("Looking for SSH Keys..."); IEnumerable <PSObject> results; bool success = SshKeyPairUtils.FindSSHKeys(out results); if (success) { location = results.ElementAt(0).ToString(); Dialogue($"I have found your SSH Keys at {location}."); return(true); } else { Dialogue("I was unable to locate your SSH Keys.", "I can create new SSH Keys for you."); bool shouldCreateSSHKeys = AskYesNo("Shall I proceed?"); if (shouldCreateSSHKeys) { Dialogue("Alright then, I will need a valid email address to create your SSH Keys.", "For example: [email protected]"); string email = ReadInput(); Dialogue("I will now proceed.", "This may take a few seconds..."); var keyPair = SshKeyPairUtils.CreateSSHKeyPair(email); location = SshKeyPairUtils.SaveKeyPair(keyPair); Dialogue("My apologies for the delay...", "Your SSH Keys are now ready.", $"I have saved them at {location}."); return(true); } } location = ""; return(false); }
private static void UploadKeys() { string location; bool success = GetSSHKeys(out location); if (success) { Dialogue("I can open your prefered Git Hosting site & add your public key to your clipboard."); bool openKeys = AskYesNo("Should I proceed?"); if (openKeys) { SshKeyPairUtils.ClipSSHKeys(location); } } }