Replace default --image flag with MarkFlagsOneRequired() from spf13/cobra

This commit is contained in:
Seednode 2023-11-05 08:23:49 -06:00
parent 625877a924
commit 61ea0b9670
2 changed files with 4 additions and 4 deletions

View File

@ -12,7 +12,7 @@ import (
) )
const ( const (
ReleaseVersion string = "3.1.0" ReleaseVersion string = "3.2.0"
) )
var ( var (
@ -119,6 +119,8 @@ func init() {
rootCmd.CompletionOptions.HiddenDefaultCmd = true rootCmd.CompletionOptions.HiddenDefaultCmd = true
rootCmd.MarkFlagsOneRequired("audio", "code", "flash", "images", "text", "video")
rootCmd.SilenceErrors = true rootCmd.SilenceErrors = true
rootCmd.SetHelpCommand(&cobra.Command{ rootCmd.SetHelpCommand(&cobra.Command{
Hidden: true, Hidden: true,

View File

@ -483,9 +483,7 @@ func ServePage(args []string) error {
formats.Add(video.Format{}) formats.Add(video.Format{})
} }
// enable image support if no other flags are passed, to retain backwards compatibility if Images || All {
// to be replaced with rootCmd.MarkFlagsOneRequired on next spf13/cobra update
if Images || All || len(formats) == 0 {
formats.Add(images.Format{DisableButtons: DisableButtons, Fun: Fun}) formats.Add(images.Format{DisableButtons: DisableButtons, Fun: Fun})
} }