From 61ea0b9670e1bc3f44252c1e99a336fe16ab263b Mon Sep 17 00:00:00 2001 From: Seednode Date: Sun, 5 Nov 2023 08:23:49 -0600 Subject: [PATCH] Replace default --image flag with MarkFlagsOneRequired() from spf13/cobra --- cmd/root.go | 4 +++- cmd/web.go | 4 +--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index 3da7ada..57e2cbb 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -12,7 +12,7 @@ import ( ) const ( - ReleaseVersion string = "3.1.0" + ReleaseVersion string = "3.2.0" ) var ( @@ -119,6 +119,8 @@ func init() { rootCmd.CompletionOptions.HiddenDefaultCmd = true + rootCmd.MarkFlagsOneRequired("audio", "code", "flash", "images", "text", "video") + rootCmd.SilenceErrors = true rootCmd.SetHelpCommand(&cobra.Command{ Hidden: true, diff --git a/cmd/web.go b/cmd/web.go index a75bc26..7833d2a 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -483,9 +483,7 @@ func ServePage(args []string) error { formats.Add(video.Format{}) } - // enable image support if no other flags are passed, to retain backwards compatibility - // to be replaced with rootCmd.MarkFlagsOneRequired on next spf13/cobra update - if Images || All || len(formats) == 0 { + if Images || All { formats.Add(images.Format{DisableButtons: DisableButtons, Fun: Fun}) }