2024-06-02 05:11:56 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/spf13/cobra"
|
2024-06-02 06:03:47 +00:00
|
|
|
"log"
|
|
|
|
|
|
|
|
service "spud/service"
|
|
|
|
service_definition "spud/service_definition"
|
2024-06-02 05:11:56 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var cli = &cobra.Command{
|
|
|
|
Use: "spud",
|
|
|
|
Short: "A not-entirely-terrible-way to manage self-hosted services.",
|
|
|
|
}
|
|
|
|
|
|
|
|
var start = &cobra.Command{
|
|
|
|
Use: "start",
|
|
|
|
Short: "Creates or updates a service based on the provided definition.",
|
|
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
|
|
pathProvided := args[0]
|
2024-06-02 06:03:47 +00:00
|
|
|
def, err := service_definition.GetServiceDefinitionFromFile(pathProvided)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
service.CreateService(def)
|
2024-06-02 05:11:56 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
cli.AddCommand(start)
|
|
|
|
cli.Execute()
|
|
|
|
}
|