github.com/xuyutom/docker@v1.6.0/graph/tag.go (about)

     1  package graph
     2  
     3  import (
     4  	"github.com/docker/docker/engine"
     5  )
     6  
     7  func (s *TagStore) CmdTag(job *engine.Job) engine.Status {
     8  	if len(job.Args) != 2 && len(job.Args) != 3 {
     9  		return job.Errorf("Usage: %s IMAGE REPOSITORY [TAG]\n", job.Name)
    10  	}
    11  	var tag string
    12  	if len(job.Args) == 3 {
    13  		tag = job.Args[2]
    14  	}
    15  	if err := s.Set(job.Args[1], tag, job.Args[0], job.GetenvBool("force")); err != nil {
    16  		return job.Error(err)
    17  	}
    18  	return engine.StatusOK
    19  }