feat: basic structure
This commit is contained in:
31
cmd/alist.go
31
cmd/alist.go
@ -1,7 +1,32 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"github.com/alist-org/alist/v3/bootstrap"
|
||||
"github.com/alist-org/alist/v3/cmd/args"
|
||||
"github.com/alist-org/alist/v3/conf"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println("Hello, world.")
|
||||
func init() {
|
||||
flag.StringVar(&args.Config, "conf", "data/config.json", "config file")
|
||||
flag.BoolVar(&args.Debug, "debug", false, "start with debug mode")
|
||||
flag.BoolVar(&args.Version, "version", false, "print version info")
|
||||
flag.BoolVar(&args.Password, "password", false, "print current password")
|
||||
flag.BoolVar(&args.NoPrefix, "no-prefix", false, "disable env prefix")
|
||||
flag.Parse()
|
||||
}
|
||||
|
||||
func Init() {
|
||||
if args.Version {
|
||||
fmt.Printf("Built At: %s\nGo Version: %s\nAuthor: %s\nCommit ID: %s\nVersion: %s\nWebVersion: %s\n",
|
||||
conf.BuiltAt, conf.GoVersion, conf.GitAuthor, conf.GitCommit, conf.Version, conf.WebVersion)
|
||||
os.Exit(0)
|
||||
}
|
||||
bootstrap.InitConfig()
|
||||
bootstrap.Log()
|
||||
}
|
||||
func main() {
|
||||
Init()
|
||||
}
|
||||
|
Reference in New Issue
Block a user