diff --git a/README.md b/README.md index 1d0cb57..76219a1 100644 --- a/README.md +++ b/README.md @@ -76,8 +76,8 @@ Available Commands: version Print version Flags: - -c, --cache only scan directories once, at startup (incompatible with --filter) - -f, --filter enable filtering via query parameters (incompatible with --cache) + -c, --cache only scan directories once, at startup (or when filters are applied) + -f, --filter enable filtering via query parameters -h, --help help for roulette -p, --port uint16 port to listen on (default 8080) -r, --recursive recurse into subdirectories diff --git a/cmd/files.go b/cmd/files.go index 01a8b36..5109bfd 100644 --- a/cmd/files.go +++ b/cmd/files.go @@ -482,7 +482,7 @@ func prepareDirectories(files *Files, sort string) []string { func pickFile(args []string, filters *Filters, sort string, fileCache *[]string) (string, error) { var fileList []string - if Cache && len(*fileCache) != 0 { + if Cache && filters.IsEmpty() && len(*fileCache) != 0 { fileList = *fileCache } else { files := &Files{ diff --git a/cmd/root.go b/cmd/root.go index fcd86c8..89f21a7 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -52,9 +52,8 @@ func Execute() { } func init() { - rootCmd.Flags().BoolVarP(&Cache, "cache", "c", false, "only scan directories once, at startup (incompatible with --filter)") - rootCmd.Flags().BoolVarP(&Filter, "filter", "f", false, "enable filtering via query parameters (incompatible with --cache)") - rootCmd.MarkFlagsMutuallyExclusive("cache", "filter") + rootCmd.Flags().BoolVarP(&Cache, "cache", "c", false, "only scan directories once, at startup (or when filters are applied)") + rootCmd.Flags().BoolVarP(&Filter, "filter", "f", false, "enable filtering via query parameters") rootCmd.Flags().Uint16VarP(&Port, "port", "p", 8080, "port to listen on") rootCmd.Flags().BoolVarP(&Recursive, "recursive", "r", false, "recurse into subdirectories") rootCmd.Flags().BoolVarP(&Sort, "sort", "s", false, "enable sorting via query parameters") diff --git a/cmd/version.go b/cmd/version.go index 5c8ced3..8133d9b 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -10,7 +10,7 @@ import ( "github.com/spf13/cobra" ) -var Version = "0.29.1" +var Version = "0.30.0" func init() { rootCmd.AddCommand(versionCmd)