mirror of
https://github.com/songquanpeng/message-pusher.git
synced 2025-09-27 04:26:31 +08:00
chore: update text prompt
This commit is contained in:
@@ -6,14 +6,30 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
Port = flag.Int("port", 3000, "the listening port")
|
PrintVersion = flag.Bool("version", false, "Print the version of the program and exits.")
|
||||||
PrintVersion = flag.Bool("version", false, "print version and exit")
|
PrintHelp = flag.Bool("help", false, "Print the help message and exits.")
|
||||||
LogDir = flag.String("log-dir", "", "specify the log directory")
|
Port = flag.Int("port", 3000, "Specify the listening port. Default is 3000.")
|
||||||
|
LogDir = flag.String("log-dir", "", "Specify the directory for log files.")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func printHelp() {
|
||||||
|
fmt.Println(fmt.Sprintf("Message Pusher %s - Your all in one message push system.", Version))
|
||||||
|
fmt.Println("Copyright (C) 2023 JustSong. All rights reserved.")
|
||||||
|
fmt.Println("GitHub: https://github.com/songquanpeng/message-pusher")
|
||||||
|
fmt.Println("Usage: message-pusher [options]")
|
||||||
|
fmt.Println("Options:")
|
||||||
|
flag.CommandLine.VisitAll(func(f *flag.Flag) {
|
||||||
|
name := fmt.Sprintf("-%s", f.Name)
|
||||||
|
usage := strings.Replace(f.Usage, "\n", "\n ", -1)
|
||||||
|
fmt.Printf(" -%-14s%s\n", name, usage)
|
||||||
|
})
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
@@ -22,6 +38,10 @@ func init() {
|
|||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if *PrintHelp {
|
||||||
|
printHelp()
|
||||||
|
}
|
||||||
|
|
||||||
if os.Getenv("SESSION_SECRET") != "" {
|
if os.Getenv("SESSION_SECRET") != "" {
|
||||||
SessionSecret = os.Getenv("SESSION_SECRET")
|
SessionSecret = os.Getenv("SESSION_SECRET")
|
||||||
}
|
}
|
||||||
|
2
main.go
2
main.go
@@ -24,7 +24,7 @@ var indexPage []byte
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
common.SetupGinLog()
|
common.SetupGinLog()
|
||||||
common.SysLog("system started")
|
common.SysLog("Message Pusher " + common.Version + " started")
|
||||||
if os.Getenv("GIN_MODE") != "debug" {
|
if os.Getenv("GIN_MODE") != "debug" {
|
||||||
gin.SetMode(gin.ReleaseMode)
|
gin.SetMode(gin.ReleaseMode)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user