diff --git a/README.md b/README.md index 57a7b49..237337c 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ The remaining four endpoints—`/available_extensions`, `/enabled_extensions`, ` ## Refresh -If the `--refresh-interval` flag is passed and a positive-value `refresh=` query parameter is provided, the page will reload after that interval. +If the `--refresh` flag is passed and a positive-value `refresh=` query parameter is provided, the page will reload after that interval. This can be used to generate a sort of slideshow of files. @@ -125,7 +125,7 @@ Flags: --prefix string root path for http handlers (for reverse proxying) (default "/") --profile register net/http/pprof handlers -r, --recursive recurse into subdirectories - --refresh-interval enable automatic page refresh via query parameter + --refresh enable automatic page refresh via query parameter --russian remove selected images after serving -s, --sort enable sorting --text enable support for text files diff --git a/cmd/root.go b/cmd/root.go index d41aaaa..818faaf 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -32,7 +32,7 @@ var ( Prefix string Profile bool Recursive bool - RefreshInterval bool + Refresh bool Russian bool Sorting bool Text bool @@ -80,7 +80,7 @@ func init() { rootCmd.Flags().StringVar(&Prefix, "prefix", "/", "root path for http handlers (for reverse proxying)") rootCmd.Flags().BoolVar(&Profile, "profile", false, "register net/http/pprof handlers") rootCmd.Flags().BoolVarP(&Recursive, "recursive", "r", false, "recurse into subdirectories") - rootCmd.Flags().BoolVar(&RefreshInterval, "refresh-interval", false, "enable automatic page refresh via query parameter") + rootCmd.Flags().BoolVar(&Refresh, "refresh", false, "enable automatic page refresh via query parameter") rootCmd.Flags().BoolVar(&Russian, "russian", false, "remove selected images after serving") rootCmd.Flags().BoolVarP(&Sorting, "sort", "s", false, "enable sorting") rootCmd.Flags().BoolVar(&Text, "text", false, "enable support for text files") diff --git a/cmd/uri.go b/cmd/uri.go index ec1d087..8706496 100644 --- a/cmd/uri.go +++ b/cmd/uri.go @@ -19,7 +19,7 @@ func refreshInterval(r *http.Request) (int64, string) { duration, err := time.ParseDuration(interval) switch { - case err != nil || duration == 0 || !RefreshInterval: + case err != nil || duration == 0 || !Refresh: return 0, "0ms" case duration < 500*time.Millisecond: return 500, "500ms" @@ -86,7 +86,7 @@ func generateQueryParams(filters *filters, sortOrder, refreshInterval string) st hasParams = true } - if RefreshInterval { + if Refresh { if hasParams { queryParams.WriteString("&") }