Skip to content

Commit

Permalink
Merge pull request #1686 from rsteube/ytdlp-printtofile
Browse files Browse the repository at this point in the history
yt-dlp: print-to-file file completion
  • Loading branch information
rsteube authored May 9, 2023
2 parents 5e8c665 + ca58c01 commit f8695ba
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
14 changes: 11 additions & 3 deletions completers/yt-dlp_completer/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ func init() {
"config-locations": carapace.ActionFiles(),
"convert-subs": ytdlp.ActionSubtitleFormats(),
"convert-thumbnails": ytdlp.ActionThumbnailFormats(),
"cookies-from-browser": carapace.ActionValues("brave", "chrome", "chromium", "edge", "firefox", "opera", "safari", "vivaldi"),
"cookies-from-browser": ytdlp.ActionBrowsers(),
"date": time.ActionDate(),
"dateafter": time.ActionDate(),
"datebefore": time.ActionDate(),
Expand All @@ -312,8 +312,16 @@ func init() {
}),
"load-info-json": carapace.ActionFiles(),
"merge-output-format": ytdlp.ActionOutputFormats().UniqueList("/"),
"recode-video": ytdlp.ActionVideoFormats(),
"remux-video": ytdlp.ActionVideoFormats(),
"print-to-file": carapace.ActionCallback(func(c carapace.Context) carapace.Action {
switch len(c.Parts) {
case 1:
return carapace.ActionFiles()
default:
return carapace.ActionValues()
}
}),
"recode-video": ytdlp.ActionVideoFormats(),
"remux-video": ytdlp.ActionVideoFormats(),
"sponsorblock-mark": carapace.ActionMultiParts(",", func(c carapace.Context) carapace.Action {
a := ytdlp.ActionSponsorblockCategories()
for index, part := range c.Parts {
Expand Down
20 changes: 20 additions & 0 deletions pkg/actions/tools/ytdlp/browser.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package ytdlp

import "github.com/rsteube/carapace"

// ActionBrowsers completes browsers
//
// brave
// chrome
func ActionBrowsers() carapace.Action {
return carapace.ActionValues(
"brave",
"chrome",
"chromium",
"edge",
"firefox",
"opera",
"safari",
"vivaldi",
).Tag("browsers")
}

0 comments on commit f8695ba

Please sign in to comment.