updated logging
This commit is contained in:
14
main.go
14
main.go
@@ -13,6 +13,7 @@ import (
|
||||
"fes/modules/doc"
|
||||
"fes/modules/new"
|
||||
"fes/modules/server"
|
||||
"fes/modules/ui"
|
||||
"fes/modules/version"
|
||||
)
|
||||
|
||||
@@ -34,13 +35,13 @@ func init() {
|
||||
func main() {
|
||||
flag.Usage = func() {
|
||||
fmt.Fprintf(flag.CommandLine.Output(), "Usage: %s [options] <command> <project_dir>\n", os.Args[0])
|
||||
fmt.Fprintf(os.Stderr, "Commands:")
|
||||
fmt.Fprintf(os.Stderr, " new <project_dir> Create a new project")
|
||||
fmt.Fprintf(os.Stderr, " doc Open documentation")
|
||||
fmt.Fprintf(os.Stderr, " run <project_dir> Start the server")
|
||||
fmt.Fprintf(os.Stderr, "Options:")
|
||||
fmt.Fprintln(flag.CommandLine.Output(), "Commands:")
|
||||
fmt.Fprintln(flag.CommandLine.Output(), " new <project_dir> Create a new project")
|
||||
fmt.Fprintln(flag.CommandLine.Output(), " doc Open documentation")
|
||||
fmt.Fprintln(flag.CommandLine.Output(), " run <project_dir> Start the server")
|
||||
fmt.Fprintln(flag.CommandLine.Output(), "Options:")
|
||||
flag.PrintDefaults()
|
||||
fmt.Fprintf(os.Stderr, "For bug reports, contact a developer and describe the issue. Provide the output of the `-V1` flag.")
|
||||
fmt.Fprintln(flag.CommandLine.Output(), "For bug reports, contact a developer and describe the issue. Provide the output of the `-V1` flag.")
|
||||
}
|
||||
|
||||
showVersion := flag.Bool("version", false, "Show version and exit")
|
||||
@@ -89,6 +90,7 @@ func main() {
|
||||
os.Exit(1)
|
||||
}
|
||||
case "run":
|
||||
ui.Log("Fes version=%s, commit=%s, just started", version.VERSION, version.GetCommit())
|
||||
if err := server.Start(dir); err != nil {
|
||||
if errors.Is(err, os.ErrNotExist) {
|
||||
fmt.Fprintf(os.Stderr, "%s does not exist\n", dir)
|
||||
|
||||
Reference in New Issue
Block a user