cmd

package
v0.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2024 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const SelfUpdateLong = `` /* 207-byte string literal not displayed */

Variables

View Source
var ConfCmd = &cobra.Command{
	Use:   "conf",
	Short: "init or check",
	Long:  `Init or check config file for correctness`,
	PreRunE: func(cmd *cobra.Command, args []string) error {
		return bootstrap.New(bootstrap.WithContext(cmd.Context())).Add(
			bootstrap.InitConfig,
		).Run()
	},
	RunE: Conf,
}
View Source
var RootCmd = &cobra.Command{
	Use:   "synctv",
	Short: "synctv",
	Long:  `synctv https://github.com/synctv-org/synctv`,
	PersistentPreRun: func(cmd *cobra.Command, args []string) {
		s, err := utils.GetEnvFiles(flags.DataDir)
		if err != nil {
			logrus.Warnf("get env files error: %v", err)
		}
		if flags.Dev {
			ss, err := utils.GetEnvFiles(".")
			if err != nil {
				logrus.Warnf("get env files error: %v", err)
			}
			s = append(s, ss...)
		}
		if len(s) != 0 {
			if flags.EnvFileOverload {
				log.Infof("overload env from: %v", s)
				err = godotenv.Overload(s...)
			} else {
				log.Infof("load env from: %v", s)
				err = godotenv.Load(s...)
			}
			if err != nil {
				logrus.Fatalf("load env error: %v", err)
			}
		}
	},
}
View Source
var SelfUpdateCmd = &cobra.Command{
	Use:   "self-update",
	Short: "self-update",
	Long:  SelfUpdateLong,
	PreRunE: func(cmd *cobra.Command, args []string) error {
		return bootstrap.New(bootstrap.WithContext(cmd.Context())).Add(
			bootstrap.InitStdLog,
		).Run()
	},
	RunE: SelfUpdate,
}
View Source
var ServerCmd = &cobra.Command{
	Use:   "server",
	Short: "Start synctv-server",
	Long:  `Start synctv-server`,
	PreRunE: func(cmd *cobra.Command, args []string) error {
		boot := bootstrap.New(bootstrap.WithContext(cmd.Context())).Add(
			bootstrap.InitSysNotify,
			bootstrap.InitConfig,
			bootstrap.InitGinMode,
			bootstrap.InitLog,
			bootstrap.InitDatabase,
			bootstrap.InitProvider,
			bootstrap.InitOp,
			bootstrap.InitRtmp,
			bootstrap.InitVendorBackend,
			bootstrap.InitSetting,
		)
		if !flags.DisableUpdateCheck {
			boot.Add(bootstrap.InitCheckUpdate)
		}
		return boot.Run()
	},
	Run: Server,
}
View Source
var VersionCmd = &cobra.Command{
	Use:   "version",
	Short: "Print the version number of Sync TV Server",
	Long:  `All software has versions. This is Sync TV Server's`,
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Printf("synctv %s\n", version.Version)
		fmt.Printf("- web/version: %s\n", version.WebVersion)
		fmt.Printf("- git/commit: %s\n", version.GitCommit)
		fmt.Printf("- os/platform: %s\n", runtime.GOOS)
		fmt.Printf("- os/arch: %s\n", runtime.GOARCH)
		fmt.Printf("- go/version: %s\n", runtime.Version())
		fmt.Printf("- go/compiler: %s\n", runtime.Compiler)
	},
}

Functions

func Conf added in v0.2.0

func Conf(cmd *cobra.Command, args []string) error

func Execute

func Execute()

func SelfUpdate added in v0.2.4

func SelfUpdate(cmd *cobra.Command, args []string) error

func Server

func Server(cmd *cobra.Command, args []string)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL