feat: 更新错误处理,提供更清晰的路径错误信息
This commit is contained in:
@@ -2,7 +2,9 @@ package cmd
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"path/filepath"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ func commandGenRouteE(cmd *cobra.Command, args []string) error {
|
|||||||
|
|
||||||
modulePath := filepath.Join(path, "app/http")
|
modulePath := filepath.Join(path, "app/http")
|
||||||
if _, err := os.Stat(modulePath); os.IsNotExist(err) {
|
if _, err := os.Stat(modulePath); os.IsNotExist(err) {
|
||||||
log.Fatal("modules dir not exist, ", modulePath)
|
return fmt.Errorf("routes directory not found: %s (set --path to your project root)", modulePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
// controllerPattern := regexp.MustCompile(`controller(_?\w+)?\.go`)
|
// controllerPattern := regexp.MustCompile(`controller(_?\w+)?\.go`)
|
||||||
|
|||||||
Reference in New Issue
Block a user