diff --git a/.gitignore b/.gitignore index 493ed7bb7c..0cd7a5b61d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,6 @@ # if you want to ignore files created by your editor/tools, # please consider a global .gitignore https://help.github.com/articles/ignoring-files # please do not open a pull request to add something created by your editor or tools -dep -testdep +/dep +/testdep +*.exe diff --git a/cmd/dep/main.go b/cmd/dep/main.go index 1bce452299..6a99025194 100644 --- a/cmd/dep/main.go +++ b/cmd/dep/main.go @@ -38,6 +38,7 @@ func main() { &ensureCommand{}, &removeCommand{}, &hashinCommand{}, + &versionCommand{}, } usage := func() { diff --git a/cmd/dep/version.go b/cmd/dep/version.go new file mode 100644 index 0000000000..bdbeadfbfd --- /dev/null +++ b/cmd/dep/version.go @@ -0,0 +1,36 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +import ( + "flag" + "fmt" + + "github.com/golang/dep" +) + +const versionShortHelp = `Display version` +const versionLongHelp = ` +Display version of this application. +` + +const Version = "0.0.1" + +func (cmd *versionCommand) Name() string { return "version" } +func (cmd *versionCommand) Args() string { return "" } +func (cmd *versionCommand) ShortHelp() string { return versionShortHelp } +func (cmd *versionCommand) LongHelp() string { return versionLongHelp } +func (cmd *versionCommand) Hidden() bool { return false } + +func (cmd *versionCommand) Register(fs *flag.FlagSet) { +} + +type versionCommand struct { +} + +func (cmd *versionCommand) Run(ctx *dep.Ctx, args []string) error { + fmt.Println(Version) + return nil +}