You've already forked filebrowser
mirror of
https://github.com/filebrowser/filebrowser.git
synced 2025-11-26 14:25:26 +08:00
- In the root command, all flags are now correctly available as environmental variables, except for `--config` flag. This was already supposed to be the case, but due to bugs in the implementation it didn't work properly. - All configuration options (unless I missed something) that are available as flags should now properly update the configuration when using the `config init` and `config set` commands. - Flag names are now consistently in the lowerCamelCase format. All flags that were in a different format have been updated in a backwards compatible way. For a transitionary period of at least 6 months, both will work: - `--dir-mode` --> `--dirMode` - `--hide-login-button` --> `--hideLoginButton` - `--create-user-dir` --> `--createUserDir` - `--minimum-password-length` --> `--minimumPasswordLength` - `--socket-perm` --> `--socketPerm` - `--disable-thumbnails` --> `--disableThumbnails` - `--disable-preview-resize` --> `--disablePreviewResize` - `--disable-exec` --> `--disableExec` - `--disable-type-detection-by-header` --> `--disableTypeDetectionByHeader` - `--img-processors` --> `--imageProcessors` - `--cache-dir` --> `--cacheDir` - `--token-expiration-time` --> `--tokenExpirationTime` - `--baseurl` --> `--baseURL`
40 lines
822 B
Go
40 lines
822 B
Go
package cmd
|
|
|
|
import (
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func init() {
|
|
cmdsCmd.AddCommand(cmdsLsCmd)
|
|
cmdsLsCmd.Flags().StringP("event", "e", "", "event name, without 'before' or 'after'")
|
|
}
|
|
|
|
var cmdsLsCmd = &cobra.Command{
|
|
Use: "ls",
|
|
Short: "List all commands for each event",
|
|
Long: `List all commands for each event.`,
|
|
Args: cobra.NoArgs,
|
|
RunE: python(func(cmd *cobra.Command, _ []string, d *pythonData) error {
|
|
s, err := d.store.Settings.Get()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
evt, err := cmd.Flags().GetString("event")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
if evt == "" {
|
|
printEvents(s.Commands)
|
|
} else {
|
|
show := map[string][]string{}
|
|
show["before_"+evt] = s.Commands["before_"+evt]
|
|
show["after_"+evt] = s.Commands["after_"+evt]
|
|
printEvents(show)
|
|
}
|
|
|
|
return nil
|
|
}, pythonConfig{}),
|
|
}
|