Path: blob/main/components/ide/jetbrains/cli/cmd/preview.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"log"8"net/http"910"github.com/spf13/cobra"11)1213var previewCmd = &cobra.Command{14Use: "preview",15Run: func(cmd *cobra.Command, args []string) {16url := getCliApiUrl()17query := url.Query()18query.Add("op", "preview")19query.Add("url", args[0])20url.RawQuery = query.Encode()2122resp, err := http.Get(url.String())23if err != nil {24log.Fatal(err)25}26if resp.StatusCode != http.StatusOK {27log.Fatal(resp.Status)28}29},30}3132func init() {33rootCmd.AddCommand(previewCmd)34}353637