chapel-lang / chapel

a Productive Parallel Programming Language
https://chapel-lang.org
Other
1.78k stars 419 forks source link

Add support for tab completion for compiler and testing scripts #5348

Open ronawho opened 7 years ago

ronawho commented 7 years ago

Not having tab completion is such a drag

I have no idea what's involved to support bash_completion files, but http://askubuntu.com/questions/68175/how-to-create-script-with-auto-complete might be a good lead.

For our python scripts, we might be able to take advantage of argcomplete (https://argcomplete.readthedocs.io/en/latest/) or optcomplete(https://pypi.python.org/pypi/optcomplete). I think argcomplete/optcomplete do dynamic completion and require argcomplete/optcomplete to be installed. We can install them as part of the test-venv, but for user-facing tools we might want simple bash scripts to source

Here's a list of scripts/tools/executables that would benefit from tab completion:

Core:

User-facing tools:

Developer tools:

Testing scripts:

ronawho commented 6 years ago

https://github.com/chapel-lang/chapel/pull/7929 added support for compiler autocompletion

ben-albrecht commented 6 years ago

I got the args for mason with these commands, but creating the mason completion script will require some further thought due to handling subcommands (not accounted for here):

optional_abbr=`mason --help | grep -v '^[A-Za-z]' | grep '^.*--' |        \
        sed -e 's;^\(.*--[^ ]*\).*$;\1;' | grep ',' | sed -e 's;,.*$;;' | \
        xargs echo`

optional=`mason --help | grep -v '^[A-Za-z]' | grep '^.*--' |      \
          sed -e 's;^\(.*--[^ ]*\).*$;\1;' | sed -e 's;-[A-Za-z],;   ;' | \
          xargs echo`

arg=`mason --help | grep -v '^[A-Za-z]' | grep -v '^.*--'  | \
     grep -v '<command>' | grep -v '\[options\]'  | sed 's/^[ \t]*//' | \
     cut -d" " -f1 | xargs echo`