github.com/jfrog/jfrog-cli-core@v1.12.1/artifactory/utils/yarn/info.go (about)

     1  package yarn
     2  
     3  import (
     4  	gofrogcmd "github.com/jfrog/gofrog/io"
     5  	"github.com/jfrog/jfrog-client-go/utils/errorutils"
     6  	"strings"
     7  )
     8  
     9  func Info(executablePath string) (string, error) {
    10  	infoCmdConfig := createInfoCmdConfig(executablePath)
    11  	output, err := gofrogcmd.RunCmdOutput(infoCmdConfig)
    12  	if err != nil {
    13  		return "", errorutils.CheckError(err)
    14  	}
    15  	infoValue := strings.TrimSpace(output)
    16  
    17  	return infoValue, nil
    18  }
    19  
    20  func createInfoCmdConfig(executablePath string) *YarnConfig {
    21  	return &YarnConfig{
    22  		Executable: executablePath,
    23  		Command:    []string{"info", "--all", "--recursive", "--json"},
    24  		StrWriter:  nil,
    25  		ErrWriter:  nil,
    26  	}
    27  }