github.com/everdrone/grab@v0.1.7-0.20230416223925-40674b995521/main.go (about)

     1  // to build on windows (powershell)
     2  // $VHASH = git rev-parse HEAD; go build -ldflags="-s -w -X grab/internal/config.CommitHash=${VHASH}"
     3  
     4  // to build on linux/macos
     5  // VHASH=$(git rev-parse HEAD) go build -ldflags="-s -w -X grab/internal/config.CommitHash=${VHASH}"
     6  
     7  package main
     8  
     9  import (
    10  	"fmt"
    11  	"os"
    12  
    13  	"github.com/everdrone/grab/cmd"
    14  	"github.com/everdrone/grab/internal/utils"
    15  )
    16  
    17  func main() {
    18  	// from: https://github.com/spf13/cobra/issues/914#issuecomment-548411337
    19  	if err := cmd.RootCmd.Execute(); err != nil {
    20  		// if we have ErrSilent, we don't want to print the error
    21  		if err != utils.ErrSilent {
    22  			fmt.Fprintln(os.Stderr, err)
    23  		}
    24  		os.Exit(1)
    25  	}
    26  }