-
Notifications
You must be signed in to change notification settings - Fork 446
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: update and improve supported completion cases #4559
base: main
Are you sure you want to change the base?
Conversation
multiple improvements to the completion logic - add multiple new commands, - replace `snap` with `pack` - add supported architectures for `--target-arch` and `--build-for` - do not parse snapcraft.yaml as format changes between core20 and core22 bases, and we have only a list of predefined options regardless, use those. - build | clean | pull | stage | prime: parse snapcraft.yaml for suggested parts - use shell/sed based custom parser. we do not want to bring yq as an extra dependency, and calling back to python parser demonstrated to be very slow Signed-off-by: Ondrej Kubik <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #4559 +/- ##
==========================================
- Coverage 89.18% 88.33% -0.85%
==========================================
Files 321 327 +6
Lines 21777 21961 +184
==========================================
- Hits 19421 19399 -22
- Misses 2356 2562 +206 ☔ View full report in Codecov by Sentry. |
@cmatsuoka @sergiusens I finally for a moment to revisit this. |
@@ -6,15 +20,15 @@ _snapcraft() | |||
COMPREPLY=() | |||
cur="${COMP_WORDS[COMP_CWORD]}" | |||
prev="${COMP_WORDS[COMP_CWORD-1]}" | |||
opts="help init list-plugins plugins login logout export-login list-keys keys create-key register-key register registered list-registered push release clean cleanbuild pull build sign-build stage prime snap update define search gated validate history status close enable-ci expand-extensions extension extensions list-extensions" | |||
opts="help init list-plugins plugins login logout export-login list-keys keys create-key register-key register registered list-registered push release clean cleanbuild pull build sign-build stage prime pack update define search gated validate history status close enable-ci expand-extensions extension extensions list-extensions --target-arch --build-for --debug --shell --shell-after ---provider -h --help --verbose" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of these new parameters should only be available if a lifecycle command has already been declared. For example, snapcraft plugins --build-for
isn't valid
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lengau that is fair point, let me see if this can be fixed in easy way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably the easiest way would be to check whether any of the lifecycle commands are in $COMP_WORDS
:
for i in "${COMP_WORDS}"; do
case "$i" in
pull);&
build);&
stage);&
prime);&
pack);&
clean)
opts="${opts} --build-for --target-arch --debug --shell --shell-after --provider"
break
esac
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kubiko any update?
Co-authored-by: Alex Lowe <[email protected]>
Co-authored-by: Alex Lowe <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #4559 +/- ##
=======================================
Coverage 88.36% 88.36%
=======================================
Files 327 327
Lines 21997 21997
=======================================
Hits 19438 19438
Misses 2559 2559 ☔ View full report in Codecov by Sentry. |
multiple improvements to the completion logic
snap
withpack
--target-arch
and--build-for
snapcraft.yaml
as the format changes between core20 and core22 bases, and we have only a list of predefined options regardless, use those.snapcraft.yaml
for suggested partsshell
/sed
based custom parser. we do not want to bring yq as an extra dependency, and calling back to the python parser demonstrated to be very slow