github.com/koron/hk@v0.0.0-20150303213137-b8aeaa3ab34c/which_app.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  )
     6  
     7  var cmdWhichApp = &Command{
     8  	Run:      runWhichApp,
     9  	Usage:    "which-app",
    10  	NeedsApp: true,
    11  	Category: "app",
    12  	Short:    "show which app is selected, if any" + extra,
    13  	Long: `
    14  Looks for a git remote named "heroku" with a remote URL in the
    15  correct form. If successful, it prints the corresponding app name.
    16  Otherwise, it prints an error message to stderr and exits with a
    17  nonzero status.
    18  
    19  To suppress the error message, run 'hk app 2>/dev/null'.
    20  `,
    21  }
    22  
    23  func runWhichApp(cmd *Command, args []string) {
    24  	fmt.Println(mustApp())
    25  }