mirror of
https://github.com/kevin-DL/revel-cmd.git
synced 2026-01-23 07:21:28 +00:00
#19 Revel version command added
This commit is contained in:
@@ -4,7 +4,6 @@ package main
|
|||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/agtorre/gocolorize"
|
|
||||||
"io"
|
"io"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"os"
|
"os"
|
||||||
@@ -12,9 +11,11 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"text/template"
|
"text/template"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/agtorre/gocolorize"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Cribbed from the genius organization of the "go" command.
|
// Command structure cribbed from the genius organization of the "go" command.
|
||||||
type Command struct {
|
type Command struct {
|
||||||
Run func(args []string)
|
Run func(args []string)
|
||||||
UsageLine, Short, Long string
|
UsageLine, Short, Long string
|
||||||
@@ -36,6 +37,7 @@ var commands = []*Command{
|
|||||||
cmdPackage,
|
cmdPackage,
|
||||||
cmdClean,
|
cmdClean,
|
||||||
cmdTest,
|
cmdTest,
|
||||||
|
cmdVersion,
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|||||||
34
revel/version.go
Normal file
34
revel/version.go
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
// Copyright (c) 2012-2016 The Revel Framework Authors, All rights reserved.
|
||||||
|
// Revel Framework source code and usage is governed by a MIT style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"runtime"
|
||||||
|
|
||||||
|
"github.com/revel/revel"
|
||||||
|
)
|
||||||
|
|
||||||
|
var cmdVersion = &Command{
|
||||||
|
UsageLine: "version",
|
||||||
|
Short: "displays the Revel Framework and Go version",
|
||||||
|
Long: `
|
||||||
|
Displays the Revel Framework and Go version.
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
revel version
|
||||||
|
`,
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
cmdVersion.Run = versionApp
|
||||||
|
}
|
||||||
|
|
||||||
|
func versionApp(args []string) {
|
||||||
|
fmt.Printf("Version(s):")
|
||||||
|
fmt.Printf("\n Revel v%v (%v)", revel.VERSION, revel.BUILD_DATE)
|
||||||
|
fmt.Printf("\n %s %s/%s\n\n", runtime.Version(), runtime.GOOS, runtime.GOARCH)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user