DEV Community

Cover image for Another contribution to Fig Autocomplete
TD
TD

Posted on

Another contribution to Fig Autocomplete

I got to add another contribution to Fig Autocomplete. I implemented autocompletion for the asr command this time. You can read about my first contribution here.

About Fig Autocomplete

Fig Autocomplete is an open-source tool that integrates well, regardless of your choice of terminal. It helps users complete commands through autocomplete suggestions.

Contributing

Fig Autocomplete is an excellent open-source project to add your contribution. The documentation is well-maintained, and you can generate the template within seconds to get started.

How I learned about Fig Autocomplete

Fig Autocomplete was one of the organizations that participated in this year's Hacktoberfest. While searching for issues to work on for Hacktoberfest 2022, I found Fig Autocomplete in results yielded by GitHub's Advanced Search feature.

Things that were different this time:

  • I had to use subcommands along with options
  • I had to use dependsOn as opposed to exclusiveOn
  • I grouped options based on their types
  • I had to use displayAs to display an alternative name for a subcommand

How using displayAs improves Autocomplete's suggestion:

asr-demo

Simply typing asr re yields two results. Since I configured the second subcommand in the menu with displayAs property, it's showing restore[exact] instead of restoreexact.

I opted to use an alias for restoreexact to enhance readability.

Upon selecting restore[exact] and pressing enter, the actual name of the subcommand gets added:
asr-demo-2

Currently, I am waiting for my PR to be reviewed and merged.

Final Thoughts

Although this contribution was less significant (in terms of length) than my initial contribution to Fig Autocomplete, I got to use different settings and formats to achieve the desired result. Hence, this contribution felt renewed.

Top comments (0)