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