Add prompt information for zsh completions #25207

Open
opened 2026-02-21 13:42:13 -05:00 by deekerman · 2 comments
Owner

Originally created by @Freed-Wu on GitHub (Apr 26, 2022).

Checklist

  • I'm reporting a feature request
  • I've verified that I'm running youtube-dl version 2021.12.17
  • I've searched the bugtracker for similar feature requests including closed ones

Description

WRITE DESCRIPTION HERE

Now, the completion of youtube-dl is: (e.g. zsh)

❯ youtube-dl --<Tab>
--abort-on-error                 --dump-pages                     --hls-prefer-native              --no-continue                    --rm-cache-dir
...

How about:

❯ youtube-dl --<Tab>
option
--abort-on-error                  Abort downloading of further videos (in the playlist or the command line) if an error occurs
--abort-on-unavailable-fragment   Abort downloading when some fragment is not available
...

It is just

#compdef youtube-dl

compdef _gnu_generic youtube-dl

I believe if use youtube-dl --completion zsh to generate a shell script, it can be done better.

Originally created by @Freed-Wu on GitHub (Apr 26, 2022). <!-- ###################################################################### WARNING! IGNORING THE FOLLOWING TEMPLATE WILL RESULT IN ISSUE CLOSED AS INCOMPLETE ###################################################################### --> ## Checklist <!-- Carefully read and work through this check list in order to prevent the most common mistakes and misuse of youtube-dl: - First of, make sure you are using the latest version of youtube-dl. Run `youtube-dl --version` and ensure your version is 2021.12.17. If it's not, see https://yt-dl.org/update on how to update. Issues with outdated version will be REJECTED. - Search the bugtracker for similar feature requests: http://yt-dl.org/search-issues. DO NOT post duplicates. - Finally, put x into all relevant boxes (like this [x]) --> - [x] I'm reporting a feature request - [x] I've verified that I'm running youtube-dl version **2021.12.17** - [x] I've searched the bugtracker for similar feature requests including closed ones ## Description <!-- Provide an explanation of your issue in an arbitrary form. Please make sure the description is worded well enough to be understood, see https://github.com/ytdl-org/youtube-dl#is-the-description-of-the-issue-itself-sufficient. Provide any additional information, suggested solution and as much context and examples as possible. --> WRITE DESCRIPTION HERE Now, the completion of youtube-dl is: (e.g. zsh) ``` ❯ youtube-dl --<Tab> --abort-on-error --dump-pages --hls-prefer-native --no-continue --rm-cache-dir ... ``` How about: ``` ❯ youtube-dl --<Tab> option --abort-on-error Abort downloading of further videos (in the playlist or the command line) if an error occurs --abort-on-unavailable-fragment Abort downloading when some fragment is not available ... ``` It is just ``` #compdef youtube-dl compdef _gnu_generic youtube-dl ``` I believe if use `youtube-dl --completion zsh` to generate a shell script, it can be done better.
Author
Owner

@dirkf commented on GitHub (Apr 27, 2022):

My expertise only goes as far as https://github.com/zsh-users/zsh-completions, but yt-dl has a GNU-like --help. Although yt-dl has a zsh completion, what happens with this?

compdef _gnu_generic youtube-dl
@dirkf commented on GitHub (Apr 27, 2022): My expertise only goes as far as https://github.com/zsh-users/zsh-completions, but yt-dl has a GNU-like `--help`. Although yt-dl has a zsh completion, what happens with this? ```zsh compdef _gnu_generic youtube-dl ```
Author
Owner

@Freed-Wu commented on GitHub (Aug 8, 2022):

compdef _gnu_geneirc XXX is just a fallback solution, it use zsh to parse XXX --help to get a completion, but it is slow than the provided completion script. And it cannot provide higher functions, such as:

❯ youtube-dl --convert-subs <Tab>
selection
ass  lrc  srt  vtt
❯ youtube-dl --proxy <Tab>
URL
file:      ftp://     gopher://  http://    https://
@Freed-Wu commented on GitHub (Aug 8, 2022): `compdef _gnu_geneirc XXX` is just a fallback solution, it use zsh to parse `XXX --help` to get a completion, but it is slow than the provided completion script. And it cannot provide higher functions, such as: ``` ❯ youtube-dl --convert-subs <Tab> selection ass lrc srt vtt ❯ youtube-dl --proxy <Tab> URL file: ftp:// gopher:// http:// https:// ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/youtube-dl-ytdl-org#25207
No description provided.