Skip to content

Commit

Permalink
Add open cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
Thibault Gilles committed Feb 27, 2018
1 parent fac376c commit 5d5b069
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions cmd/open.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package cmd

import (
"log"

"github.com/aestek/tc/internal/config"
"github.com/skratchdot/open-golang/open"
"github.com/spf13/cobra"
)

func init() {
RootCmd.AddCommand(openCmd)
}

var openCmd = &cobra.Command{
Use: "op",
Short: "Open a project",
Args: cobra.MinimumNArgs(1),
Run: func(cmd *cobra.Command, args []string) {
env := args[0]

c, err := config.Load()
if err != nil {
log.Fatal(err)
}

buildID := c.BuildIDPrompt(projectName(), env)

open.Run(c.URL + "/viewType.html?buildTypeId=" + buildID)
},
}

0 comments on commit 5d5b069

Please sign in to comment.