Add bash-completion helper for command names#77
Conversation
This is based on the helper used by gazebo's gz command. It has minimal functionality for now in order to demonstrate the approach. Signed-off-by: Steve Peters <scpeters@openrobotics.org>
chapulina
left a comment
There was a problem hiding this comment.
Nice! Works well for me! It would be interesting to document it somewhere, like the README, so users compiling from source know what to do.
I also wonder if there's a way of automatically sourcing this file for users compiling from source which is not specific to colcon. Maybe something within the ign command itself? Just a thought for the future.
Signed-off-by: Steve Peters <scpeters@openrobotics.org>
added from-source instructions in 174a600
I'm not sure, but I agree that would be nice. Let's keep that in mind for the future |
🎉 New feature
Part of #1.
Summary
This adds a bash-completion helper based on the script used by gazebo's
gzcommand. It currently only autocompletes the names ofigncommands using the output ofign --commands. Subsequent improvements may add support for autocompleting the-*arguments and ignition topic and service names. This pull request is intentionally simple to demonstrate the approach.My goal is to emulate the approach taken by the hub command, which hosts its own completion scripts in its
etcfolder.hubdoes not install these scripts withmake installsince the install location varies with each operating system distribution. Instead, the installation path is encoded in the homebrew formula and debian metadata. This enablesignautocompletion support on these two platforms ifbash-completionis enabled without requiring additional user action. The debian metadata and homebrew formula can be updated with the next prerelease.Test it
Source the script in a terminal window and hit
<TAB>after typingignand see the list of available commands.To test a prototype of the homebrew formula, checkout osrf/homebrew-simulation@38ae6c1 and install
ignition-toolswith the--HEADflag. Ifignition-toolshas dependent packages already installed, use the following:Checklist
codecheckpassed (See contributing)Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining
Signed-off-bymessages.