Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bash-completion helper for command names #77

Merged
merged 2 commits into from
Jan 15, 2022

Conversation

scpeters
Copy link
Member

🎉 New feature

Part of #1.

Summary

This adds a bash-completion helper based on the script used by gazebo's gz command. It currently only autocompletes the names of ign commands using the output of ign --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 etc folder. hub does not install these scripts with make install since the install location varies with each operating system distribution. Instead, the installation path is encoded in the homebrew formula and debian metadata. This enables ign autocompletion support on these two platforms if bash-completion is 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 typing ign and see the list of available commands.

To test a prototype of the homebrew formula, checkout osrf/homebrew-simulation@38ae6c1 and install ignition-tools with the --HEAD flag. If ignition-tools has dependent packages already installed, use the following:

brew remove ignition-tools --ignore-dependencies
brew install --HEAD ignition-tools

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

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 <[email protected]>
@github-actions github-actions bot added 🌱 garden Ignition Garden 🏢 edifice Ignition Edifice 🏯 fortress Ignition Fortress 🏰 citadel Ignition Citadel labels Jan 12, 2022
@scpeters scpeters mentioned this pull request Jan 12, 2022
@chapulina chapulina added the OOBE 📦✨ Out-of-box experience label Jan 12, 2022
Copy link
Contributor

@chapulina chapulina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@scpeters
Copy link
Member Author

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.

added from-source instructions in 174a600

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.

I'm not sure, but I agree that would be nice. Let's keep that in mind for the future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏰 citadel Ignition Citadel 🏢 edifice Ignition Edifice 🏯 fortress Ignition Fortress 🌱 garden Ignition Garden OOBE 📦✨ Out-of-box experience
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants