mirror of
https://github.com/ferdzo/fs.git
synced 2026-04-05 08:26:28 +00:00
Initial FS CLI
This commit is contained in:
26
cmd/execute.go
Normal file
26
cmd/execute.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fs/app"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
func Execute(build BuildInfo) error {
|
||||
build = build.normalized()
|
||||
|
||||
if len(os.Args) == 1 {
|
||||
return runServerWithSignals()
|
||||
}
|
||||
|
||||
root := newRootCommand(build)
|
||||
return root.Execute()
|
||||
}
|
||||
|
||||
func runServerWithSignals() error {
|
||||
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
|
||||
defer stop()
|
||||
return app.RunServer(ctx)
|
||||
}
|
||||
Reference in New Issue
Block a user