-
Notifications
You must be signed in to change notification settings - Fork 55
Bash completion for flags #392
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
Merged
Merged
Changes from 13 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
4c68fe6
bash completion for flags
mabelzhang 2644900
rename functions ign->gz
mabelzhang 8c634be
add installation
mabelzhang 5e1edfc
ign->gz
mabelzhang 3cfa886
Merge branch 'ign-gui3' into mabelzhang/tab_completion
mabelzhang 15e2f53
add test
mabelzhang 3aeac47
install to versioned place
mabelzhang 5944868
license; var name
mabelzhang 6885f54
Merge branch 'ign-gui3' into mabelzhang/tab_completion
ahcorde 4318a77
change var name to align with existing test
mabelzhang 0f22b8e
Merge branch 'mabelzhang/tab_completion' of github.com:ignitionroboti…
mabelzhang 6f7291b
do not hard code flags in test
mabelzhang f3e2550
do not print
mabelzhang e7211eb
add env var for apple
mabelzhang bab2541
add env vars for apple
mabelzhang cbbd746
Merge branch 'ign-gui3' into mabelzhang/tab_completion
chapulina fe2be11
Restore logic introduced in PR 240
chapulina 2866b7a
Fix tests
chapulina File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Copyright (C) 2022 Open Source Robotics Foundation | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
# bash tab-completion | ||
|
||
# This is a per-library function definition, used in conjunction with the | ||
# top-level entry point in ign-tools. | ||
|
||
GZ_GUI_COMPLETION_LIST=" | ||
-l --list | ||
-s --standalone | ||
-c --config | ||
-v --verbose | ||
-h --help | ||
--force-version | ||
--versions | ||
" | ||
|
||
function _gz_gui | ||
{ | ||
if [[ ${COMP_WORDS[COMP_CWORD]} == -* ]]; then | ||
# Specify options (-*) word list for this subcommand | ||
COMPREPLY=($(compgen -W "$GZ_GUI_COMPLETION_LIST" \ | ||
-- "${COMP_WORDS[COMP_CWORD]}" )) | ||
return | ||
else | ||
# Just use bash default auto-complete, because we never have two | ||
# subcommands in the same line. If that is ever needed, change here to | ||
# detect subsequent subcommands | ||
COMPREPLY=($(compgen -o default -- "${COMP_WORDS[COMP_CWORD]}")) | ||
return | ||
fi | ||
} | ||
|
||
function _gz_gui_flags | ||
{ | ||
for word in $GZ_GUI_COMPLETION_LIST; do | ||
echo "$word" | ||
done | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.