Merge pull request #25 from IchBinLeoon/master

Rename getCmd variable to downloadCmd
This commit is contained in:
ByteDream 2022-04-18 17:02:04 +02:00 committed by GitHub
commit aeb159960c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -28,7 +28,7 @@ var (
downloadGoroutinesFlag int downloadGoroutinesFlag int
) )
var getCmd = &cobra.Command{ var downloadCmd = &cobra.Command{
Use: "download", Use: "download",
Short: "Download a video", Short: "Download a video",
Args: cobra.MinimumNArgs(1), Args: cobra.MinimumNArgs(1),
@ -72,23 +72,23 @@ var getCmd = &cobra.Command{
} }
func init() { func init() {
getCmd.Flags().StringVarP(&downloadAudioFlag, "audio", downloadCmd.Flags().StringVarP(&downloadAudioFlag, "audio",
"a", "a",
string(systemLocale(false)), string(systemLocale(false)),
"The locale of the audio. Available locales: "+strings.Join(allLocalesAsStrings(), ", ")) "The locale of the audio. Available locales: "+strings.Join(allLocalesAsStrings(), ", "))
getCmd.Flags().StringVarP(&downloadSubtitleFlag, downloadCmd.Flags().StringVarP(&downloadSubtitleFlag,
"subtitle", "subtitle",
"s", "s",
"", "",
"The locale of the subtitle. Available locales: "+strings.Join(allLocalesAsStrings(), ", ")) "The locale of the subtitle. Available locales: "+strings.Join(allLocalesAsStrings(), ", "))
cwd, _ := os.Getwd() cwd, _ := os.Getwd()
getCmd.Flags().StringVarP(&downloadDirectoryFlag, downloadCmd.Flags().StringVarP(&downloadDirectoryFlag,
"directory", "directory",
"d", "d",
cwd, cwd,
"The directory to download the file(s) into") "The directory to download the file(s) into")
getCmd.Flags().StringVarP(&downloadOutputFlag, downloadCmd.Flags().StringVarP(&downloadOutputFlag,
"output", "output",
"o", "o",
"{title}.ts", "{title}.ts",
@ -104,7 +104,7 @@ func init() {
"\t{audio} » Audio locale of the video\n"+ "\t{audio} » Audio locale of the video\n"+
"\t{subtitle} » Subtitle locale of the video") "\t{subtitle} » Subtitle locale of the video")
getCmd.Flags().StringVarP(&downloadResolutionFlag, downloadCmd.Flags().StringVarP(&downloadResolutionFlag,
"resolution", "resolution",
"r", "r",
"best", "best",
@ -113,13 +113,13 @@ func init() {
"\tAvailable abbreviations: 1080p, 720p, 480p, 360p, 240p\n"+ "\tAvailable abbreviations: 1080p, 720p, 480p, 360p, 240p\n"+
"\tAvailable common-use words: best (best available resolution), worst (worst available resolution)") "\tAvailable common-use words: best (best available resolution), worst (worst available resolution)")
getCmd.Flags().IntVarP(&downloadGoroutinesFlag, downloadCmd.Flags().IntVarP(&downloadGoroutinesFlag,
"goroutines", "goroutines",
"g", "g",
runtime.NumCPU(), runtime.NumCPU(),
"Sets how many parallel segment downloads should be used") "Sets how many parallel segment downloads should be used")
rootCmd.AddCommand(getCmd) rootCmd.AddCommand(downloadCmd)
} }
func download(urls []string) error { func download(urls []string) error {