github.com/KusionStack/kpm@v0.8.4-0.20240326033734-dc72298a30e5/pkg/cmd/cmd_pull.go (about)

     1  // Copyright 2023 The KCL Authors. All rights reserved.
     2  // Deprecated: The entire contents of this file will be deprecated. 
     3  // Please use the kcl cli - https://github.com/kcl-lang/cli.
     4  
     5  package cmd
     6  
     7  import (
     8  	"github.com/urfave/cli/v2"
     9  	"kcl-lang.io/kpm/pkg/client"
    10  )
    11  
    12  // NewPullCmd new a Command for `kpm pull`.
    13  func NewPullCmd(kpmcli *client.KpmClient) *cli.Command {
    14  	return &cli.Command{
    15  		Hidden: false,
    16  		Name:   "pull",
    17  		Usage:  "pull kcl package from OCI registry.",
    18  		Flags: []cli.Flag{
    19  			&cli.StringFlag{
    20  				Name:  FLAG_TAG,
    21  				Usage: "the tag for oci artifact",
    22  			},
    23  		},
    24  		Action: func(c *cli.Context) error {
    25  			return KpmPull(c, kpmcli)
    26  		},
    27  	}
    28  }
    29  
    30  func KpmPull(c *cli.Context, kpmcli *client.KpmClient) error {
    31  	return kpmcli.PullFromOci(c.Args().Get(1), c.Args().Get(0), c.String(FLAG_TAG))
    32  }