feat(upload): add first prototype of File storage, svg database and svg processing. Also added --help command
All checks were successful
build / Go-Build (push) Successful in 1m5s
All checks were successful
build / Go-Build (push) Successful in 1m5s
This commit is contained in:
37
internal/command/commandline.go
Normal file
37
internal/command/commandline.go
Normal file
@@ -0,0 +1,37 @@
|
||||
package command
|
||||
|
||||
import (
|
||||
"flag"
|
||||
|
||||
"tomatentum.net/svg-templater/internal/server"
|
||||
"tomatentum.net/svg-templater/pkg/svg"
|
||||
)
|
||||
|
||||
var (
|
||||
help bool
|
||||
generateTokenFlag bool
|
||||
deleteTokenFlag bool
|
||||
datapath string
|
||||
)
|
||||
|
||||
func PrepareCommandLine() {
|
||||
flag.BoolVar(&help, "help", false, "Displays the help String")
|
||||
flag.BoolVar(&generateTokenFlag, "tokengen", false, "Generate token with name")
|
||||
flag.BoolVar(&deleteTokenFlag, "tokendel", false, "Delete token with name")
|
||||
flag.StringVar(&datapath, "data", "/var/lib/svg-templater", "Override data directory")
|
||||
}
|
||||
|
||||
func HandleCommandline() {
|
||||
flag.Parse()
|
||||
if generateTokenFlag {
|
||||
GenerateTokenCommand()
|
||||
} else if deleteTokenFlag {
|
||||
DeleteTokenCommand()
|
||||
} else if help {
|
||||
flag.PrintDefaults()
|
||||
} else {
|
||||
svg.Storage = svg.NewFileStorage(datapath)
|
||||
server.PrepareHTTP()
|
||||
server.Start()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user