~jameinel/juju-core/api-registry-tracks-type

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright 2012, 2013 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.

package cmd

import (
	"launchpad.net/gnuflag"

	"launchpad.net/juju-core/version"
)

// VersionCommand is a cmd.Command that prints the current version.
type VersionCommand struct {
	CommandBase
	out Output
}

func (v *VersionCommand) Info() *Info {
	return &Info{
		Name:    "version",
		Purpose: "print the current version",
	}
}

func (v *VersionCommand) SetFlags(f *gnuflag.FlagSet) {
	v.out.AddFlags(f, "smart", DefaultFormatters)
}

func (v *VersionCommand) Run(ctxt *Context) error {
	return v.out.Write(ctxt, version.Current.String())
}