github.com/MealCraft/glide@v0.13.4/action/tree.go (about)

     1  package action
     2  
     3  import (
     4  	"container/list"
     5  	"os"
     6  
     7  	"github.com/Masterminds/glide/msg"
     8  	"github.com/Masterminds/glide/tree"
     9  	"github.com/Masterminds/glide/util"
    10  )
    11  
    12  // Tree prints a tree representing dependencies.
    13  func Tree(basedir string, showcore bool) {
    14  	msg.Warn("The tree command is deprecated and will be removed in a future version")
    15  	buildContext, err := util.GetBuildContext()
    16  	if err != nil {
    17  		msg.Die("Failed to get a build context: %s", err)
    18  	}
    19  	myName := buildContext.PackageName(basedir)
    20  
    21  	if basedir == "." {
    22  		var err error
    23  		basedir, err = os.Getwd()
    24  		if err != nil {
    25  			msg.Die("Could not get working directory")
    26  		}
    27  	}
    28  
    29  	msg.Puts(myName)
    30  	l := list.New()
    31  	l.PushBack(myName)
    32  	tree.Display(buildContext, basedir, myName, 1, showcore, l)
    33  }