github.com/makyo/juju@v0.0.0-20160425123129-2608902037e9/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: 14 15 juju show-machine <machineID> ... 16 17 For example: 18 19 juju show-machine 0 20 21 or for multiple machines 22 (the following will display status for machines 1, 2 & 3): 23 24 juju show-machine 1 2 3 25 26 Default format is in yaml, other formats can be specified 27 with the "--format" option. Available formats are yaml, 28 tabular, and json 29 ` 30 31 // NewShowMachineCommand returns a command that shows details on the specified machine[s]. 32 func NewShowMachineCommand() cmd.Command { 33 return modelcmd.Wrap(newShowMachineCommand(nil)) 34 } 35 36 func newShowMachineCommand(api statusAPI) *showMachineCommand { 37 showCmd := &showMachineCommand{} 38 showCmd.defaultFormat = "yaml" 39 showCmd.api = api 40 return showCmd 41 } 42 43 // showMachineCommand struct holds details on the specified machine[s]. 44 type showMachineCommand struct { 45 baselistMachinesCommand 46 } 47 48 // Info implements Command.Info. 49 func (c *showMachineCommand) Info() *cmd.Info { 50 return &cmd.Info{ 51 Name: "show-machine", 52 Args: "<machineID> ...", 53 Purpose: "show a machines status", 54 Doc: showMachineCommandDoc, 55 Aliases: []string{"show-machines"}, 56 } 57 } 58 59 // Init captures machineId's to show from CL args. 60 func (c *showMachineCommand) Init(args []string) error { 61 c.machineIds = args 62 return nil 63 }