adept/cmd/root.go
Gregory Ballantine 1ccd481f9e
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
Refactored a bit to put the configuration and logging setup before Cobra launches, so it doesn't need to be handled in every sub-command
2022-09-15 10:09:10 -04:00

36 lines
892 B
Go

package cmd
import (
"fmt"
"os"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"git.metaunix.net/BitGoblin/adept/transcoder"
)
// ./adept - this is the primary command and is how the service is intended to be launched
var rootCmd = &cobra.Command{
Use: "adept",
Short: "Adept is a video transcoder service",
Long: `An automated video transcoder service that archives ingested footage.
https://git.metaunix.net/BitGoblin/adept`,
Run: func(cmd *cobra.Command, args []string) {
// initialize the video repository
r := transcoder.NewRepository(viper.GetString("transcoder.repository"))
// create transcoder object and start the main loop
t := transcoder.NewTranscoder(*r)
t.Start()
},
}
// this is the main function to launch Cobra
func Execute() {
if err := rootCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
}
}