I created the example files in my Debian. Indeed,
dot -T png -o myTab doesn't work. Then (after completing manually)
dot -T png -o myGraph.graphviz.png myTab also doesn't work. There are two separate issues.
The general manual for Graphviz programs specifies:
Write output to file outfile. […]
Bash completion in my Debian obeys this literally: it supports
-o outfile. Even if the latter works with
dot (and I don't know this), the completion doesn't support it. You should proceed like this:
dot -T png -omyTab
without any space after
-o. In my tests the above works.
To make the second Tab work I inspected
/usr/share/bash-completion/completions/dot. The relevant line near the end is:
This will offer you directories to descend into and files to specify, but only files with names ending with
.DOT. Probably you can manually provide a file not matching this pattern and nothing bad will happen, yet if you rely on the completion mechanism then the file name should end properly.
In fact I don't know
dot at all, I know Bash completions a little. Maybe the requirement doesn't make sense and the completion for
dot would be more helpful if it allowed any file. In such case I copy the original file to
/etc/bash_completion.d/ and modify the copy, so the line
at the end of the function becomes
This is a system-wide change. The change will not affect existing shells, so start a new
bash to test it. If you cannot (or don't want to) modify
/etc/bash_completion.d/ then see this answer. It provides a way to have your private (user-specific)
Note this change will allow you to type
dot -T png -o myTab and the completion will work. However in this particular case it has nothing to do with
-o internally, it's the general completion for operands and it would work even after some unexpected or invalid option (e.g.
dot -T png -: myTab).