Skip to content

Commit

Permalink
[dev] Add "previewctl get url" (#19167)
Browse files Browse the repository at this point in the history
  • Loading branch information
geropl authored Dec 1, 2023
1 parent eb6a504 commit 3e79652
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions dev/preview/previewctl/cmd/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func newGetCmd(logger *logrus.Logger) *cobra.Command {
cmd.AddCommand(
newGetNameSubCmd(),
newGetActiveCmd(logger),
newGetUrlSubCmd(),
)

return cmd
Expand All @@ -52,6 +53,26 @@ func newGetNameSubCmd() *cobra.Command {
return cmd
}

func newGetUrlSubCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "url",
Short: "",
RunE: func(cmd *cobra.Command, args []string) error {
previewName, err := preview.GetName(branch)
if err != nil {
return err
}

previewUrl := fmt.Sprintf("https://%s.preview.gitpod-dev.com", previewName)
fmt.Println(previewUrl)

return nil
},
}

return cmd
}

func newGetActiveCmd(logger *logrus.Logger) *cobra.Command {
ctx := context.Background()

Expand Down

0 comments on commit 3e79652

Please sign in to comment.