use flags to switch server method (web or cli)

This commit is contained in:
Ruidy 2022-01-10 14:11:39 -04:00
parent 456e1829ff
commit 054fb7293e
2 changed files with 17 additions and 4 deletions

View file

@ -2,10 +2,16 @@ lint:
golint cmd/... golint cmd/...
golint passgen/... golint passgen/...
run: dev:
air air
run:
go main.go
run-web:
go main.go --web=t
web: web:
cd client && npm run start cd client && npm run start
.PHONY: lint run .PHONY: lint run dev run-web

11
main.go
View file

@ -1,6 +1,7 @@
package main package main
import ( import (
"flag"
"log" "log"
"net/http" "net/http"
@ -9,8 +10,14 @@ import (
) )
func main() { func main() {
serveWeb() web := flag.Bool("web", false, "")
//cli() flag.Parse()
if *web {
serveWeb()
return
}
cli()
} }
func cli() { func cli() {