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

Bash completion for flags #392

Merged
merged 18 commits into from
Jun 14, 2022
Merged

Bash completion for flags #392

merged 18 commits into from
Jun 14, 2022

Conversation

mabelzhang
Copy link
Contributor

@mabelzhang mabelzhang commented Apr 30, 2022

🎉 New feature

Part of gazebosim/gz-tools#1
Used together with gazebosim/gz-tools#87

Summary

Bash completion script for flags available to this subcommand.
This is a standalone function that depends on a new script in gazebosim/gz-tools#87 to call this.

Test it

After sourcing the dependent script in ign-tools, source the script in this PR:

. src/cmd/gui.bash_completion.sh

If you just tab, you get the default system tab-completion that shows the files in the current directory:

$ ign gui <tab>

If you type -, and then tab, you get the tab-completion for all the flags available for this subcommand:

$ ign gui -<tab>
--config         --help           --standalone     --versions       -h               -s               
--force-version  --list           --verbose        -c               -l               -v               

Then you can type partial flags, and it'll do tab-completion normally for you, such as

$ ign gui --ver
--verbose   --versions  

It also works for multiple flags, like ign gui --<flag1> --<flag2> ...

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • 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.

Signed-off-by: Mabel Zhang <[email protected]>
@mabelzhang mabelzhang added the OOBE 📦✨ Out-of-box experience label Apr 30, 2022
@mabelzhang mabelzhang added this to Inbox in Core development via automation Apr 30, 2022
@github-actions github-actions bot added the 🏰 citadel Ignition Citadel label Apr 30, 2022
@mabelzhang mabelzhang moved this from Inbox to In review in Core development Apr 30, 2022
Signed-off-by: Mabel Zhang <[email protected]>
@codecov
Copy link

codecov bot commented Apr 30, 2022

Codecov Report

Merging #392 (8c634be) into ign-gui3 (aafacbf) will not change coverage.
The diff coverage is n/a.

@@            Coverage Diff            @@
##           ign-gui3     #392   +/-   ##
=========================================
  Coverage     31.12%   31.12%           
=========================================
  Files            29       29           
  Lines          1343     1343           
=========================================
  Hits            418      418           
  Misses          925      925           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update aafacbf...8c634be. Read the comment docs.

Signed-off-by: Mabel Zhang <[email protected]>
@chapulina chapulina added the needs upstream release Blocked by a release of an upstream library label May 4, 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.

Same comments as in plugin, let's use gz wherever we can, and see if it's possible to write a test that checks that the flags are the same on the autocomplete file and the command itself.

@j-rivero j-rivero removed this from In review in Core development May 6, 2022
@codecov
Copy link

codecov bot commented May 11, 2022

Codecov Report

Merging #392 (2866b7a) into ign-gui3 (e3cf225) will not change coverage.
The diff coverage is n/a.

@@            Coverage Diff            @@
##           ign-gui3     #392   +/-   ##
=========================================
  Coverage     65.45%   65.45%           
=========================================
  Files            29       29           
  Lines          3216     3216           
=========================================
  Hits           2105     2105           
  Misses         1111     1111           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e3cf225...2866b7a. Read the comment docs.

Signed-off-by: Mabel Zhang <[email protected]>
@mabelzhang
Copy link
Contributor Author

I think the comments are addressed. Ready for another pass.

@chapulina chapulina added this to Inbox in Core development via automation May 14, 2022
@chapulina chapulina moved this from Inbox to In review in Core development May 14, 2022
Signed-off-by: Mabel Zhang <[email protected]>
@chapulina chapulina requested a review from ahcorde May 23, 2022 16:57
src/CMakeLists.txt Outdated Show resolved Hide resolved
Signed-off-by: Mabel Zhang <[email protected]>
src/ign_TEST.cc Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
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.

Thanks for iterating! It's working for me after I source:

. install/share/gz/gz1.completion

@chapulina chapulina enabled auto-merge (squash) June 14, 2022 22:23
Signed-off-by: Louise Poubel <[email protected]>
@chapulina
Copy link
Contributor

Fixed the tests in 2866b7a, inspired by gazebosim/gz-plugin#57

@chapulina chapulina merged commit c7bfb8a into ign-gui3 Jun 14, 2022
Core development automation moved this from In review to Done Jun 14, 2022
@chapulina chapulina deleted the mabelzhang/tab_completion branch June 14, 2022 23:05
@chapulina chapulina removed the needs upstream release Blocked by a release of an upstream library label Jun 14, 2022
@Blast545
Copy link
Contributor

@mabelzhang This PR introduced a regression in the Gazebo Citadel Windows buildfarm, see:
ign_gui-ign-3-win#93/testReport/junit/(root)/ignTest/GuiHelpVsCompletionFlags/

C:\Jenkins\workspace\ign_gui-ign-3-win\ws\ign-gui\src\ign_TEST.cc:131
Expected: (std::string::npos) != (helpOutput.find(flag)), actual: 18446744073709551615 vs 18446744073709551615
'HAVE_IGN_TOOLS-NOTFOUND' is not recognized as an internal or external command,
operable program or batch file.

Would you please take a look? It seems like an extra environment variable has to be set on Windows to get the proper output from the command line on that test.

@chapulina
Copy link
Contributor

This PR introduced a regression in the Gazebo Citadel Windows

Ah sorry that's on me, I totally missed the failing Windows test. On it.

@chapulina chapulina mentioned this pull request Jun 16, 2022
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏰 citadel Ignition Citadel OOBE 📦✨ Out-of-box experience
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

4 participants