Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion completion-bundle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ __bundle() {
case $bundle_command in
"")
options="$options --version";;
binstubs)
options="$options --force --path --shebang --standalone --all --all-platforms";;
check)
options="$options --dry-run --gemfile --path -r --retry";;
clean)
Expand Down Expand Up @@ -64,7 +66,18 @@ __bundle() {
"" | help)
options="help install update package exec config
check show outdated console open lock viz init gem
platform clean doctor"
platform clean doctor binstubs"
;;
binstubs)
case $prev in
--path)
_filedir -d
return;;
--shebang)
options="ruby";;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm 50/50 on whether completing the default value for SHEBANG makes any sense. On one hand, it's instructive. But OTOH, if you intend to use the "ruby" shebang, then there's no reason to pass the option+arg in the first place.

So maybe I should just remove these two lines? Either way, I suppose we'd want the behavior the match with install --shebang completion.

Copy link
Owner

Choose a reason for hiding this comment

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

Perhaps we could suggest all commands that have "ruby" in the name?

# Suggest all commands that contain "ruby"; skip those that start with underscore as they are usually functions and/or private
options=$(compgen -X '!*ruby*' -c -- "$cur" | grep -v '^_')

(I had to include the grep filter because I couldn't make compgen only return commands in $PATH, not functions, and our own __ruby function would pollute the results)

This would allow one to see e.g. jruby and ruby3.4.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Perhaps. If that's desirable, that can be its own work? For now, I just removed the --shebang opt-args completion, so binstubs is consistent with install. The main goal of this PR is to support binstub flags like --all and bundled gems.

*)
options=($(__bundle_exec_ruby 'puts Bundler.definition.specs.to_hash.keys'))
esac
;;
check | install)
case $prev in
Expand Down