Skip to content

Commit 3e79652

Browse files
authored
[dev] Add "previewctl get url" (#19167)
1 parent eb6a504 commit 3e79652

File tree

1 file changed

+21
-0
lines changed
  • dev/preview/previewctl/cmd

1 file changed

+21
-0
lines changed

dev/preview/previewctl/cmd/get.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ func newGetCmd(logger *logrus.Logger) *cobra.Command {
2828
cmd.AddCommand(
2929
newGetNameSubCmd(),
3030
newGetActiveCmd(logger),
31+
newGetUrlSubCmd(),
3132
)
3233

3334
return cmd
@@ -52,6 +53,26 @@ func newGetNameSubCmd() *cobra.Command {
5253
return cmd
5354
}
5455

56+
func newGetUrlSubCmd() *cobra.Command {
57+
cmd := &cobra.Command{
58+
Use: "url",
59+
Short: "",
60+
RunE: func(cmd *cobra.Command, args []string) error {
61+
previewName, err := preview.GetName(branch)
62+
if err != nil {
63+
return err
64+
}
65+
66+
previewUrl := fmt.Sprintf("https://%s.preview.gitpod-dev.com", previewName)
67+
fmt.Println(previewUrl)
68+
69+
return nil
70+
},
71+
}
72+
73+
return cmd
74+
}
75+
5576
func newGetActiveCmd(logger *logrus.Logger) *cobra.Command {
5677
ctx := context.Background()
5778

0 commit comments

Comments
 (0)