aptly version command.

This commit is contained in:
Andrey Smirnov
2013-12-30 16:41:28 +04:00
parent a36ac3b877
commit 07891c1660
2 changed files with 31 additions and 0 deletions

27
cmd_version.go Normal file
View File

@@ -0,0 +1,27 @@
package main
import (
"fmt"
"github.com/gonuts/commander"
"github.com/gonuts/flag"
)
func aptlyVersion(cmd *commander.Command, args []string) error {
fmt.Printf("aptly version: %s\n", Version)
return nil
}
func makeCmdVersion() *commander.Command {
return &commander.Command{
Run: aptlyVersion,
UsageLine: "version",
Short: "display version",
Long: `
Shows aptly version.
ex:
$ aptly version
`,
Flag: *flag.NewFlagSet("aptly-version", flag.ExitOnError),
}
}

View File

@@ -11,6 +11,9 @@ import (
"path/filepath"
)
// aptly version
const Version = "0.1"
var cmd *commander.Command
func init() {
@@ -26,6 +29,7 @@ take snapshots and publish them back as Debian repositories.`,
makeCmdMirror(),
makeCmdSnapshot(),
makeCmdPublish(),
makeCmdVersion(),
},
}
}