Path: blob/main/components/ide/jetbrains/cli/cmd/root.go
2501 views
// Copyright (c) 2022 Gitpod GmbH. All rights reserved.1// Licensed under the GNU Affero General Public License (AGPL).2// See License.AGPL.txt in the project root for license information.34package cmd56import (7"errors"8"log"9"net/url"10"os"11"strconv"1213"github.com/spf13/cobra"14)1516var rootCmd = &cobra.Command{17Use: "idea-cli",18}1920func Execute() {21err := rootCmd.Execute()22if err != nil {23os.Exit(1)24}25}2627func getCliApiUrl() *url.URL {28var backendPort = 6334229// TODO look up under alias + qualifier, i.e. intellij or intellij-latest30if _, fileStatError := os.Stat("/ide-desktop/bin/idea-cli-dev"); !errors.Is(fileStatError, os.ErrNotExist) {31backendPort = backendPort + 132}33parsedUrl, urlParseError := url.Parse("http://localhost:" + strconv.Itoa(backendPort) + "/api/gitpod/cli")34if urlParseError != nil {35log.Fatal(urlParseError)36}37return parsedUrl38}3940func init() {}414243