github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/cmd/juju/resource/list_charm_resources.go (about)

     1  // Copyright 2015 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package resource
     5  
     6  import (
     7  	"github.com/juju/cmd"
     8  	"github.com/juju/gnuflag"
     9  
    10  	jujucmd "github.com/juju/juju/cmd"
    11  	"github.com/juju/juju/cmd/modelcmd"
    12  )
    13  
    14  const (
    15  	Deprecated      = "DEPRECATED: "
    16  	DeprecatedSince = "This command is DEPRECATED since Juju 2.3.x, please use 'juju charm-resources' instead.\n"
    17  )
    18  
    19  // ListCharmResourcesCommand implements the "juju charm resources" command.
    20  type ListCharmResourcesCommand struct {
    21  	baseCharmResourcesCommand
    22  }
    23  
    24  // NewListCharmResourcesCommand returns a new command that lists resources defined
    25  // by a charm.
    26  func NewListCharmResourcesCommand(resourceLister ResourceLister) modelcmd.ModelCommand {
    27  	var c ListCharmResourcesCommand
    28  	c.setResourceLister(resourceLister)
    29  	return modelcmd.Wrap(&c)
    30  }
    31  
    32  // Info implements cmd.Command.
    33  func (c *ListCharmResourcesCommand) Info() *cmd.Info {
    34  	i := c.baseInfo()
    35  	i.Name = "resources"
    36  	i.Aliases = []string{"list-resources"}
    37  	i.Doc = DeprecatedSince + i.Doc
    38  	i.Purpose = Deprecated + i.Purpose
    39  	return jujucmd.Info(i)
    40  }
    41  
    42  // SetFlags implements cmd.Command.
    43  func (c *ListCharmResourcesCommand) SetFlags(f *gnuflag.FlagSet) {
    44  	c.setBaseFlags(f)
    45  }
    46  
    47  // Init implements cmd.Command.
    48  func (c *ListCharmResourcesCommand) Init(args []string) error {
    49  	return c.baseInit(args)
    50  }
    51  
    52  // Run implements cmd.Command.
    53  func (c *ListCharmResourcesCommand) Run(ctx *cmd.Context) error {
    54  	ctx.Warningf(DeprecatedSince)
    55  	return c.baseRun(ctx)
    56  }