From c0265d2a6e2b06bccfe46a0355e587b672b1880f Mon Sep 17 00:00:00 2001 From: Seednode Date: Tue, 12 Sep 2023 13:51:00 -0500 Subject: [PATCH] Enable --images flag if nothing else is passed, to retain backward compatibility --- cmd/root.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index c88d058..5e52c42 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -12,7 +12,7 @@ import ( ) const ( - ReleaseVersion string = "0.70.2" + ReleaseVersion string = "0.70.3" ) var ( @@ -46,6 +46,12 @@ var ( Short: "Serves random media from the specified directories.", Args: cobra.MinimumNArgs(1), PreRun: func(cmd *cobra.Command, args []string) { + // enable image support if no other flags are passed, to retain backwards compatibility + // to be replaced with MarkFlagsOneRequired on next spf13/cobra update + if !(All || Audio || Flash || Images || Text || Videos) { + Images = true + } + if Index { cmd.MarkFlagRequired("cache") } @@ -82,8 +88,8 @@ func init() { rootCmd.Flags().BoolVarP(&Cache, "cache", "c", false, "generate directory cache at startup") rootCmd.Flags().StringVar(&CacheFile, "cache-file", "", "path to optional persistent cache file") rootCmd.Flags().BoolVarP(&Filtering, "filter", "f", false, "enable filtering") - rootCmd.Flags().BoolVar(&Flash, "flash", true, "enable support for shockwave flash files (via ruffle)") - rootCmd.Flags().BoolVar(&Images, "images", true, "enable support for image files") + rootCmd.Flags().BoolVar(&Flash, "flash", false, "enable support for shockwave flash files (via ruffle)") + rootCmd.Flags().BoolVar(&Images, "images", false, "enable support for image files") rootCmd.Flags().BoolVarP(&Index, "index", "i", false, "expose index endpoints") rootCmd.Flags().Uint64Var(&MaximumFileCount, "maximum-files", 1<<64-1, "skip directories with file counts above this value") rootCmd.Flags().Uint64Var(&MinimumFileCount, "minimum-files", 1, "skip directories with file counts below this value")