Add FFmpeg completions#5922
Merged
Merged
Conversation
faho
requested changes
Jun 5, 2019
| complete -x -c ffmpeg -s h -s "?" -o help -l help -a " | ||
| long | ||
| full | ||
| (ffmpeg -loglevel quiet -decoders | grep -v -e '=' -e ':\$' -e '^\s-' | sed 's/[\t ]/\t/g' | cut -f 3 | sed 's/^/decoder=/g') |
Member
There was a problem hiding this comment.
Could you rewrite this to use our string builtin?
E.g. `string match -rv '=|:$|^\s-' | string replace -ra '\s' \t
Member
There was a problem hiding this comment.
Also this seems like prime use of a for-loop or even function:
for thing in encoder demuxer muxer filter
printf '%s\n' $thing=(ffmpeg -loglevel quiet -{$thing}s | ...)
end
Member
There was a problem hiding this comment.
And instead of using cut based on whitespace, which has to use a different field just because this does a positional "ED" thing, use string trim to trim leading whitespace. That way it won't break if e.g. ffmpeg decides to actually display "ED" for some of these, or to start displaying it as ".D" (like the legend says!)
Member
There was a problem hiding this comment.
I.e. I'd roughly do this as
for thing in encoder demuxer muxer filter
printf '%s\n' $thing=(ffmpeg -loglevel quiet -"$thing"s |
string trim |
string match -rv '=|:\$|^\s-' |
string replace -rf '\S+\s+(\S+)\s+(\S+)' '$1\t$2')
end
Contributor
Author
|
Fixed to use builtin command. |
Member
|
Very nice, merged! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add completions for
ffmpeg,ffplayandffprobe.