Move the CLI functiontionality to the CLI package

This commit is contained in:
Juan Font Alonso 2021-04-28 16:15:45 +02:00
parent 8f67bdba8c
commit 77e5255fdd
7 changed files with 340 additions and 291 deletions

View file

@ -0,0 +1,25 @@
package cli
import (
"log"
"github.com/spf13/cobra"
)
var ServeCmd = &cobra.Command{
Use: "serve",
Short: "Launches the headscale server",
Args: func(cmd *cobra.Command, args []string) error {
return nil
},
Run: func(cmd *cobra.Command, args []string) {
h, err := getHeadscaleApp()
if err != nil {
log.Fatalf("Error initializing: %s", err)
}
err = h.Serve()
if err != nil {
log.Fatalf("Error initializing: %s", err)
}
},
}