Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a bash-completion for youtube-dl #191

Closed
phihag opened this issue Oct 12, 2011 · 4 comments
Closed

Create a bash-completion for youtube-dl #191

phihag opened this issue Oct 12, 2011 · 4 comments

Comments

@phihag
Copy link
Contributor

@phihag phihag commented Oct 12, 2011

As the number of options is growing, contributing a bash completion would be a nice idea.

@MK3IcebergSlim
Copy link

@MK3IcebergSlim MK3IcebergSlim commented Oct 12, 2011

Forgive my ignorance, could you explain the bash completion. I know if I don't know what you are talking about I shouldn't worry about it but I'm just curious.

@phihag
Copy link
Contributor Author

@phihag phihag commented Oct 12, 2011

@MK3IcebergSlim Basically, bash (or any other shell) completion allows you to enter youtube-dl in the shell and hit the Tab key to list all possible options. For example, if you enter ls -- in bash and press Tab twice, it displays something like:

$ ls --
--all         --file-type       --quote-name
--almost-all  --format=         --quoting-style=

This is just a short reminder for myself (or anyone interested) to implement the necessary script to be able to do the same with youtube-dl. Since I'm currently working on too many projects at once, it might take some time until I get to this low-priority feature.

For details, refer to the wikipedia article.

@MK3IcebergSlim
Copy link

@MK3IcebergSlim MK3IcebergSlim commented Oct 13, 2011

Gotcha

@them0nk
Copy link

@them0nk them0nk commented May 13, 2012

I wrote a very simple bash autocomplete function for my ubuntu and placed it in my .bashrc file.

__youtube-dl()
{
    local cur prev opts
    COMPREPLY=()
    cur="${COMP_WORDS[COMP_CWORD]}"
    opts="-h --help --version -U --update -i --ignore-errors -r --rate-limit -R --retries --dump-user-agent --list-extractors --playlist-start --playlist-end --match-title --reject-title --max-downloads -t --title -l --literal -A --auto-number -o --output -a --batch-file -w --no-overwrites -c --continue --no-continue --cookies --no-part --no-mtime --write-description --write-info-json -q --quiet -s --simulate --skip-download -g --get-url -e --get-title --get-thumbnail --get-description --get-filename --get-format --no-progress --console-title -v --verbose -f --format --all-formats --prefer-free-formats --max-quality -F --list-formats --write-srt --srt-lang -u --username -p --password -n --netrc --extract-audio --audio-format --audio-quality -k --keep-video"

    if [[ ${cur} == * ]] ; then
        COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
        return 0
    fi
}

complete -F __youtube-dl youtube-dl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.