private static async Task <string> GetProfileName() { var profiles = await JiraProfileService.GetAvailableProfiles(); var inputSelect = InputSelection .From <string>("Select a profile to delete") .AddOption(profiles); return((await inputSelect.RequestInput()).FirstOrDefault()); }
/// <summary> /// Print all available profiles /// </summary> /// <returns></returns> private static async Task ListProfiles() { var defaultProfile = await JiraProfileService.GetDefaultProfileName(); foreach (var p in await JiraProfileService.GetAvailableProfiles()) { string isDefault() => defaultProfile == p ? " * " : ""; Console.WriteLine(" -> " + p + isDefault()); } }
private static async Task CreateNewProfile() { var count = (await JiraProfileService.GetAvailableProfiles()).Count(); var profile = await ConsoleI.RenderForm <TerminalJiraProfile>(); var isDefault = ConsoleI.AskConfirmation("Set as default profile"); var service = await JiraProfileService.Create(profile, ""); Console.WriteLine("Created profile " + profile.ProfileName); if (count == 0 || isDefault) { await service.SetAsDefault(); Console.WriteLine("Profile set as default"); } }
private static async Task <bool> CheckHasProfiles() { return((await JiraProfileService.GetAvailableProfiles()) .Count() > 0); }