Removed mutually exclusive flag from cache and filter, now cache is bypassed if filters are supplied
This commit is contained in:
parent
b5c4534151
commit
b96ee8ac99
|
@ -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
|
||||
|
|
|
@ -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{
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var Version = "0.29.1"
|
||||
var Version = "0.30.0"
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(versionCmd)
|
||||
|
|
Loading…
Reference in New Issue