public override string Run(Spi.Input.Options options) { // get host var host = _hosts .Select(h => new { Handler = h, Weight = h.CanHandle( options.ValueOrDefault(Manager.Options.Command.Host.CanonicalName) ).Result } ) .OrderBy(a => a.Weight).Where(a => a.Weight >= 1) .FirstOrDefault().Handler; //read from credential store var foundCredentials = Task.Run(() => _credentialStore.Read(_credentialKeyFactory.GenerateKey(options).Result)).Result; if (foundCredentials != null) { return(foundCredentials.GetResponse()); } if (!IsInteractive(options)) { return(null); } var guiHost = host as Spi.Gui.Hosts.IHost; if (UseModalPrompt(options) && guiHost != null) { Program.BuildAvaloniaApp().Start((app, args) => { foundCredentials = guiHost.PromptGui(app); }, System.Environment.GetCommandLineArgs()); return(foundCredentials.GetResponse()); } else { foundCredentials = Task.Run(() => host.PromptCli()).Result; return(foundCredentials.GetResponse()); } }