aboutsummaryrefslogtreecommitdiffstats
path: root/internal/commands/version.go
blob: d15b951b32dc90194c67d0c4bd2ed81a7799d9b4 (plain) (blame)
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
32
33
34
35
36
37
38
39
40
41
42
package commands

import (
	"context"
	"flag"

	"github.com/eugenetriguba/bolt/internal/output"
	"github.com/google/subcommands"
)

type VersionCmd struct{}

func (*VersionCmd) Name() string {
	return "version"
}

func (*VersionCmd) Synopsis() string {
	return "show the current version of bolt"
}

func (*VersionCmd) Usage() string {
	return `version:
	Show the current version of Bolt
  `
}

func (cmd *VersionCmd) SetFlags(f *flag.FlagSet) {}

func (cmd *VersionCmd) Execute(
	_ context.Context,
	f *flag.FlagSet,
	_ ...interface{},
) subcommands.ExitStatus {
	consoleOutputter := output.NewConsoleOutputter()
	err := consoleOutputter.Output("bolt v0.6.0")
	if err != nil {
		consoleOutputter.Error(err)
		return subcommands.ExitFailure
	}

	return subcommands.ExitSuccess
}