mirror of
https://github.com/kevin-DL/revel-cmd.git
synced 2026-01-11 18:54:31 +00:00
Fixes issue #77 (regression bug when running revel run appname)
This commit is contained in:
14
revel/run.go
14
revel/run.go
@@ -5,8 +5,8 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"go/build"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/revel/cmd/harness"
|
"github.com/revel/cmd/harness"
|
||||||
"github.com/revel/revel"
|
"github.com/revel/revel"
|
||||||
@@ -65,14 +65,18 @@ func parseRunArgs(args []string) *RunArgs {
|
|||||||
// 1. revel run [import-path] [run-mode]
|
// 1. revel run [import-path] [run-mode]
|
||||||
// 2. revel run [import-path] [port]
|
// 2. revel run [import-path] [port]
|
||||||
// 3. revel run [run-mode] [port]
|
// 3. revel run [run-mode] [port]
|
||||||
if strings.Contains(args[0], "/") {
|
if _, err := build.Import(args[0], "", build.FindOnly); err == nil {
|
||||||
|
// 1st arg is the import path
|
||||||
inputArgs.ImportPath = args[0]
|
inputArgs.ImportPath = args[0]
|
||||||
if port, err := strconv.Atoi(args[1]); err == nil {
|
if port, err := strconv.Atoi(args[1]); err == nil {
|
||||||
|
// 2nd arg is the port number
|
||||||
inputArgs.Port = port
|
inputArgs.Port = port
|
||||||
} else {
|
} else {
|
||||||
|
// 2nd arg is the run mode
|
||||||
inputArgs.Mode = args[1]
|
inputArgs.Mode = args[1]
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// 1st arg is the run mode
|
||||||
port, err := strconv.Atoi(args[1])
|
port, err := strconv.Atoi(args[1])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errorf("Failed to parse port as integer: %s", args[1])
|
errorf("Failed to parse port as integer: %s", args[1])
|
||||||
@@ -85,12 +89,14 @@ func parseRunArgs(args []string) *RunArgs {
|
|||||||
// 1. revel run [import-path]
|
// 1. revel run [import-path]
|
||||||
// 2. revel run [port]
|
// 2. revel run [port]
|
||||||
// 3. revel run [run-mode]
|
// 3. revel run [run-mode]
|
||||||
if strings.Contains(args[0], "/") ||
|
if _, err := build.Import(args[0], "", build.FindOnly); err == nil {
|
||||||
strings.Contains(inputArgs.ImportPath, "..") {
|
// 1st arg is the import path
|
||||||
inputArgs.ImportPath = args[0]
|
inputArgs.ImportPath = args[0]
|
||||||
} else if port, err := strconv.Atoi(args[0]); err == nil {
|
} else if port, err := strconv.Atoi(args[0]); err == nil {
|
||||||
|
// 1st arg is the port number
|
||||||
inputArgs.Port = port
|
inputArgs.Port = port
|
||||||
} else {
|
} else {
|
||||||
|
// 1st arg is the run mode
|
||||||
inputArgs.Mode = args[0]
|
inputArgs.Mode = args[0]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user