Replace default --image flag with MarkFlagsOneRequired() from spf13/cobra
This commit is contained in:
parent
625877a924
commit
61ea0b9670
|
@ -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,
|
||||
|
|
|
@ -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})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue