feat: simplify flag adding
License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com> Former-commit-id: 520945c4cd979999ce7da8cc60544e1e390de3fe [formerly 5c73f94c28f67f0fb25ecff7ce999480ff0d873f] [formerly bdb85560ceeac89408c8588213ef88c5b774c8c7 [formerly fc06f642f2b1bce90430473fff9f6ac9638854d6]] Former-commit-id: dc0c81b78cdec8656bd25dad84f9589486300d34 [formerly b18cd1e0bced8b34b31863fb7c4e714905bbf0d9] Former-commit-id: cd84e54f28b9c56c3ced9da79f7fcb9a659f674a
This commit is contained in:
@@ -12,6 +12,7 @@ import (
|
||||
"github.com/filebrowser/filebrowser/v2/errors"
|
||||
"github.com/filebrowser/filebrowser/v2/settings"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/pflag"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -25,21 +26,21 @@ var configCmd = &cobra.Command{
|
||||
Args: cobra.NoArgs,
|
||||
}
|
||||
|
||||
func addConfigFlags(cmd *cobra.Command) {
|
||||
addUserFlags(cmd)
|
||||
cmd.Flags().BoolP("signup", "s", false, "allow users to signup")
|
||||
cmd.Flags().String("shell", "", "shell command to which other commands should be appended")
|
||||
func addConfigFlags(flags *pflag.FlagSet) {
|
||||
addUserFlags(flags)
|
||||
flags.BoolP("signup", "s", false, "allow users to signup")
|
||||
flags.String("shell", "", "shell command to which other commands should be appended")
|
||||
|
||||
cmd.Flags().String("auth.method", string(auth.MethodJSONAuth), "authentication type")
|
||||
cmd.Flags().String("auth.header", "", "HTTP header for auth.method=proxy")
|
||||
flags.String("auth.method", string(auth.MethodJSONAuth), "authentication type")
|
||||
flags.String("auth.header", "", "HTTP header for auth.method=proxy")
|
||||
|
||||
cmd.Flags().String("recaptcha.host", "https://www.google.com", "use another host for ReCAPTCHA. recaptcha.net might be useful in China")
|
||||
cmd.Flags().String("recaptcha.key", "", "ReCaptcha site key")
|
||||
cmd.Flags().String("recaptcha.secret", "", "ReCaptcha secret")
|
||||
flags.String("recaptcha.host", "https://www.google.com", "use another host for ReCAPTCHA. recaptcha.net might be useful in China")
|
||||
flags.String("recaptcha.key", "", "ReCaptcha site key")
|
||||
flags.String("recaptcha.secret", "", "ReCaptcha secret")
|
||||
|
||||
cmd.Flags().String("branding.name", "", "replace 'File Browser' by this name")
|
||||
cmd.Flags().String("branding.files", "", "path to directory with images and custom styles")
|
||||
cmd.Flags().Bool("branding.disableExternal", false, "disable external links such as GitHub links")
|
||||
flags.String("branding.name", "", "replace 'File Browser' by this name")
|
||||
flags.String("branding.files", "", "path to directory with images and custom styles")
|
||||
flags.Bool("branding.disableExternal", false, "disable external links such as GitHub links")
|
||||
}
|
||||
|
||||
func getAuthentication(cmd *cobra.Command) (settings.AuthMethod, auth.Auther) {
|
||||
|
||||
Reference in New Issue
Block a user