GNU Astronomy Utilities


Next: , Previous: , Up: Developing   [Contents][Index]


12.8 Bash programmable completion

Under development: While work on TAB completion is ongoing, it is not yet fully ready, please see the notice at the start of Shell TAB completion (highly customized).

Gnuastro provides Programmable completion facilities in Bash. This greatly helps users reach their desired result with minimal keystrokes, and helps them spend less time on figuring out the option names and values their acceptable values. Gnuastro’s completion script not only completes the half-written commands, but also prints suggestions based on previous arguments.

Imagine a scenario where we need to download three columns containing the right ascension, declination, and parallax from the GAIA EDR3 dataset. We have to make sure how these columns are abbreviated or spelled. So we can call the command below, and store the column names in a file such as gaia-edr3-columns.txt.

$ astquery gaia --information > gaia-edr3-columns.txt

Then we need to memorize or copy the column names of interest, and specify an output fits file name such as gaia.fits:

$ astquery gaia --dataset=edr3 --output=gaia.fits \
                --column=ra,dec,parallax

However, this is much easier using the auto-completion feature:

$ astquery gaia --dataset=edr3 --output=gaia.fits --column=[TAB]

After pressing [TAB], a full list of gaia edr3 dataset column names will be displayed. Typing the first key of the desired column and pressing [TAB] again will limit the displayed list to only the matching ones until the desired column is found.


Next: Developer’s checklist, Previous: Test scripts, Up: Developing   [Contents][Index]