github.com/axw/juju@v0.0.0-20161005053422-4bd6544d08d4/cmd/juju/machine/show.go (about) 1 // Copyright 2016 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package machine 5 6 import ( 7 "github.com/juju/cmd" 8 9 "github.com/juju/juju/cmd/modelcmd" 10 ) 11 12 const showMachineCommandDoc = ` 13 Show a specified machine on a model. Default format is in yaml, 14 other formats can be specified with the "--format" option. 15 Available formats are yaml, tabular, and json 16 17 Examples: 18 # Display status for machine 0 19 juju show-machine 0 20 21 # Display status for machines 1, 2 & 3 22 juju show-machine 1 2 3 23 24 ` 25 26 // NewShowMachineCommand returns a command that shows details on the specified machine[s]. 27 func NewShowMachineCommand() cmd.Command { 28 return modelcmd.Wrap(newShowMachineCommand(nil)) 29 } 30 31 func newShowMachineCommand(api statusAPI) *showMachineCommand { 32 showCmd := &showMachineCommand{} 33 showCmd.defaultFormat = "yaml" 34 showCmd.api = api 35 return showCmd 36 } 37 38 // showMachineCommand struct holds details on the specified machine[s]. 39 type showMachineCommand struct { 40 baselistMachinesCommand 41 } 42 43 // Info implements Command.Info. 44 func (c *showMachineCommand) Info() *cmd.Info { 45 return &cmd.Info{ 46 Name: "show-machine", 47 Args: "<machineID> ...", 48 Purpose: "Show a machine's status.", 49 Doc: showMachineCommandDoc, 50 } 51 } 52 53 // Init captures machineId's to show from CL args. 54 func (c *showMachineCommand) Init(args []string) error { 55 c.machineIds = args 56 return nil 57 }