github.com/makyo/juju@v0.0.0-20160425123129-2608902037e9/cmd/juju/charmcmd/charm.go (about)

     1  // Copyright 2016 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package charmcmd
     5  
     6  import (
     7  	"github.com/juju/cmd"
     8  )
     9  
    10  var charmDoc = `
    11  "juju charm" is the the juju CLI equivalent of the "charm" command used
    12  by charm authors, though only applicable functionality is mirrored.
    13  `
    14  
    15  const charmPurpose = "interact with charms"
    16  
    17  // Command is the top-level command wrapping all charm functionality.
    18  type Command struct {
    19  	cmd.SuperCommand
    20  }
    21  
    22  // NewSuperCommand returns a new charm super-command.
    23  func NewSuperCommand() *Command {
    24  	charmCmd := &Command{
    25  		SuperCommand: *cmd.NewSuperCommand(
    26  			cmd.SuperCommandParams{
    27  				Name:        "charm",
    28  				Doc:         charmDoc,
    29  				UsagePrefix: "juju",
    30  				Purpose:     charmPurpose,
    31  			},
    32  		),
    33  	}
    34  	spec := newCharmstoreSpec()
    35  
    36  	// Sub-commands may be registered directly here, like so:
    37  	//charmCmd.Register(newXXXCommand(spec))
    38  
    39  	// ...or externally via RegisterSubCommand().
    40  	for _, newSubCommand := range registeredSubCommands {
    41  		command := newSubCommand(spec)
    42  		charmCmd.Register(command)
    43  	}
    44  
    45  	return charmCmd
    46  }