diff --git a/cmd/admin.go b/cmd/admin.go index 62ca0f67..94412613 100644 --- a/cmd/admin.go +++ b/cmd/admin.go @@ -9,8 +9,8 @@ import ( "github.com/spf13/cobra" ) -// passwordCmd represents the password command -var passwordCmd = &cobra.Command{ +// PasswordCmd represents the password command +var PasswordCmd = &cobra.Command{ Use: "admin", Aliases: []string{"password"}, Short: "Show admin user's info", @@ -26,7 +26,7 @@ var passwordCmd = &cobra.Command{ } func init() { - rootCmd.AddCommand(passwordCmd) + RootCmd.AddCommand(PasswordCmd) // Here you will define your flags and configuration settings. diff --git a/cmd/cancel2FA.go b/cmd/cancel2FA.go index 46f7e81d..07edd116 100644 --- a/cmd/cancel2FA.go +++ b/cmd/cancel2FA.go @@ -9,8 +9,8 @@ import ( "github.com/spf13/cobra" ) -// cancel2FACmd represents the delete2fa command -var cancel2FACmd = &cobra.Command{ +// Cancel2FACmd represents the delete2fa command +var Cancel2FACmd = &cobra.Command{ Use: "cancel2fa", Short: "Delete 2FA of admin user", Run: func(cmd *cobra.Command, args []string) { @@ -28,7 +28,7 @@ var cancel2FACmd = &cobra.Command{ } func init() { - rootCmd.AddCommand(cancel2FACmd) + RootCmd.AddCommand(Cancel2FACmd) // Here you will define your flags and configuration settings. diff --git a/cmd/lang.go b/cmd/lang.go index dbe8509d..ce68c8c5 100644 --- a/cmd/lang.go +++ b/cmd/lang.go @@ -123,8 +123,8 @@ func generateSettingsJson() { //utils.WriteJsonToFile("lang/settings.json", settingsLang) } -// langCmd represents the lang command -var langCmd = &cobra.Command{ +// LangCmd represents the lang command +var LangCmd = &cobra.Command{ Use: "lang", Short: "Generate language json file", Run: func(cmd *cobra.Command, args []string) { @@ -138,7 +138,7 @@ var langCmd = &cobra.Command{ } func init() { - rootCmd.AddCommand(langCmd) + RootCmd.AddCommand(LangCmd) // Here you will define your flags and configuration settings. diff --git a/cmd/restart.go b/cmd/restart.go index e798d7d8..7795747f 100644 --- a/cmd/restart.go +++ b/cmd/restart.go @@ -7,8 +7,8 @@ import ( "github.com/spf13/cobra" ) -// restartCmd represents the restart command -var restartCmd = &cobra.Command{ +// RestartCmd represents the restart command +var RestartCmd = &cobra.Command{ Use: "restart", Short: "Restart alist server by daemon/pid file", Run: func(cmd *cobra.Command, args []string) { @@ -18,7 +18,7 @@ var restartCmd = &cobra.Command{ } func init() { - rootCmd.AddCommand(restartCmd) + RootCmd.AddCommand(RestartCmd) // Here you will define your flags and configuration settings. diff --git a/cmd/root.go b/cmd/root.go index d922500b..10d9e432 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -8,7 +8,7 @@ import ( "github.com/spf13/cobra" ) -var rootCmd = &cobra.Command{ +var RootCmd = &cobra.Command{ Use: "alist", Short: "A file list program that supports multiple storage.", Long: `A file list program that supports multiple storage, @@ -17,16 +17,16 @@ Complete documentation is available at https://alist.nn.ci/`, } func Execute() { - if err := rootCmd.Execute(); err != nil { + if err := RootCmd.Execute(); err != nil { fmt.Fprintln(os.Stderr, err) os.Exit(1) } } func init() { - rootCmd.PersistentFlags().StringVar(&flags.DataDir, "data", "data", "config file") - rootCmd.PersistentFlags().BoolVar(&flags.Debug, "debug", false, "start with debug mode") - rootCmd.PersistentFlags().BoolVar(&flags.NoPrefix, "no-prefix", false, "disable env prefix") - rootCmd.PersistentFlags().BoolVar(&flags.Dev, "dev", false, "start with dev mode") - rootCmd.PersistentFlags().BoolVar(&flags.ForceBinDir, "force-bin-dir", false, "Force to use the directory where the binary file is located as data directory") + RootCmd.PersistentFlags().StringVar(&flags.DataDir, "data", "data", "config file") + RootCmd.PersistentFlags().BoolVar(&flags.Debug, "debug", false, "start with debug mode") + RootCmd.PersistentFlags().BoolVar(&flags.NoPrefix, "no-prefix", false, "disable env prefix") + RootCmd.PersistentFlags().BoolVar(&flags.Dev, "dev", false, "start with dev mode") + RootCmd.PersistentFlags().BoolVar(&flags.ForceBinDir, "force-bin-dir", false, "Force to use the directory where the binary file is located as data directory") } diff --git a/cmd/server.go b/cmd/server.go index cc700518..0fab295b 100644 --- a/cmd/server.go +++ b/cmd/server.go @@ -20,8 +20,8 @@ import ( "github.com/spf13/cobra" ) -// serverCmd represents the server command -var serverCmd = &cobra.Command{ +// ServerCmd represents the server command +var ServerCmd = &cobra.Command{ Use: "server", Short: "Start the server at the specified address", Long: `Start the server at the specified address @@ -76,7 +76,7 @@ the address is defined in config file`, } func init() { - rootCmd.AddCommand(serverCmd) + RootCmd.AddCommand(ServerCmd) // Here you will define your flags and configuration settings. @@ -95,5 +95,5 @@ func OutAlistInit() { cmd *cobra.Command args []string ) - serverCmd.Run(cmd, args) + ServerCmd.Run(cmd, args) } diff --git a/cmd/start.go b/cmd/start.go index 27af97ba..cf447112 100644 --- a/cmd/start.go +++ b/cmd/start.go @@ -13,8 +13,8 @@ import ( "github.com/spf13/cobra" ) -// startCmd represents the start command -var startCmd = &cobra.Command{ +// StartCmd represents the start command +var StartCmd = &cobra.Command{ Use: "start", Short: "Silent start alist server with `--force-bin-dir`", Run: func(cmd *cobra.Command, args []string) { @@ -57,7 +57,7 @@ func start() { } func init() { - rootCmd.AddCommand(startCmd) + RootCmd.AddCommand(StartCmd) // Here you will define your flags and configuration settings. diff --git a/cmd/stop.go b/cmd/stop.go index 5cae3a55..09fba7b7 100644 --- a/cmd/stop.go +++ b/cmd/stop.go @@ -10,8 +10,8 @@ import ( "github.com/spf13/cobra" ) -// stopCmd represents the stop command -var stopCmd = &cobra.Command{ +// StopCmd represents the stop command +var StopCmd = &cobra.Command{ Use: "stop", Short: "Stop alist server by daemon/pid file", Run: func(cmd *cobra.Command, args []string) { @@ -44,7 +44,7 @@ func stop() { } func init() { - rootCmd.AddCommand(stopCmd) + RootCmd.AddCommand(StopCmd) // Here you will define your flags and configuration settings. diff --git a/cmd/version.go b/cmd/version.go index 2d2641ea..cdf4d71f 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -1,6 +1,5 @@ /* Copyright © 2022 NAME HERE - */ package cmd @@ -12,8 +11,8 @@ import ( "github.com/spf13/cobra" ) -// versionCmd represents the version command -var versionCmd = &cobra.Command{ +// VersionCmd represents the version command +var VersionCmd = &cobra.Command{ Use: "version", Short: "Show current version of AList", Run: func(cmd *cobra.Command, args []string) { @@ -30,7 +29,7 @@ WebVersion: %s } func init() { - rootCmd.AddCommand(versionCmd) + RootCmd.AddCommand(VersionCmd) // Here you will define your flags and configuration settings.