Refactor commands to subpackage.

This commit is contained in:
Andrey Smirnov
2014-02-19 14:59:00 +04:00
parent 35c2178074
commit eb18b04c40
12 changed files with 144 additions and 36 deletions

28
cmd/version.go Normal file
View File

@@ -0,0 +1,28 @@
package cmd
import (
"fmt"
"github.com/gonuts/commander"
"github.com/gonuts/flag"
"github.com/smira/aptly/aptly"
)
func aptlyVersion(cmd *commander.Command, args []string) error {
fmt.Printf("aptly version: %s\n", aptly.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),
}
}