public async Task OnExecute(IConsole console)
        {
            console.WriteLine("Starting local proxy");
            var port = NetworkExtensions.GetAvailablePort(Port);

            if (port != Port)
            {
                console.WriteLine($"Port {Port} is allready in use.", ConsoleColor.Yellow);
                var useOther = Prompt.GetYesNo($"Start proxy on port: {port}", true);

                if (useOther)
                {
                    Port = port;
                }
                else
                {
                    return;
                }
            }
            var options = new LocalProxyOptions
            {
                Port = Port,
                DestinationAddress = DestinationAddress
            };

            string url = await _proxyServer.StartAsync(
                options,
                CommandAborded);

            ProcessHelpers.OpenBrowser(url);

            var stopMessage = "Press 'q' or 'esc' to stop";

            console.WriteLine(stopMessage);

            while (true)
            {
                ConsoleKeyInfo key = Console.ReadKey();
                if (key.KeyChar == 'q' || key.Key == ConsoleKey.Escape)
                {
                    break;
                }
                else
                {
                    console.ClearLine();
                    console.WriteLine("Unknown command", ConsoleColor.Red);
                    Console.WriteLine(stopMessage);
                }
            }

            console.WriteLine("Stopping proxy....");
            await _proxyServer.StopAsync();

            _proxyServer.Dispose();
        }
        public async Task <IEnumerable <WorkRoot> > GetWorkRootsAsync(
            CancellationToken cancellationToken)
        {
            IUserSettingsManager settingsManager = _app.GetRequiredService <IUserSettingsManager>();

            UserSettings?settings = await settingsManager.GetAsync(cancellationToken);

            if (settings.WorkRoots.Count() == 0)
            {
                _console.WriteLine("No work roots configured!");
                _console.WriteLine("You can configure you work roots in the UI or directly in:");
                _console.WriteLine($"{SettingsStore.UserSettingsFilePath}.");

                var options = new List <string>
                {
                    "Open UI",
                    "Open User settings in code",
                    $"Add {Directory.GetCurrentDirectory()} as work root",
                    "Cancel"
                };

                var index = _console.ChooseFromList(options);

                switch (index)
                {
                case 0:
                    IWebServer?webServer = _app.GetRequiredService <IWebServer>();
                    var        url       = await webServer.StartAsync(3003);

                    ProcessHelpers.OpenBrowser(url + "/settings");
                    break;

                case 1:
                    //first ensure file exists
                    if (!File.Exists(SettingsStore.UserSettingsFilePath))
                    {
                        await AddCurrentWorkroot(settingsManager, cancellationToken);
                    }
                    IWorkspaceService workspaceService = _app.GetRequiredService <IWorkspaceService>();
                    await workspaceService.OpenFileInCode(SettingsStore.UserSettingsFilePath);

                    break;

                case 2:
                    await AddCurrentWorkroot(settingsManager, cancellationToken);

                    break;

                default:
                    break;
                }
            }

            return(settings.WorkRoots);
        }