无法在 Bash/Zsh 中找到 Rubygem 的制表符补全

发布于 2024-07-22 13:05:18 字数 105 浏览 10 评论 0原文

我没有在 Bash/Zsh 中找到 RubyGem 的制表符补全脚本。

哪里可以获取 Bahs/Zsh 中 RubyGem 的制表符补全脚本?

I have not found a tab-completion script for RubyGem in Bash/Zsh.

Where can you get the tab-completion script for RubyGem in Bahs/Zsh?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

还不是爱你 2024-07-29 13:05:18

可执行的 RubyGem 命令安装到 /usr/bin 或 /usr/local/bin 或 Ruby 所在的任何前缀中。 命令的制表符补全应该像 PATH 中的任何其他可执行文件一样工作。 如果它不起作用,请验证 RubyGems 安装命令的目录是否在您的 PATH 中。

目前还没有官方方法可以对这些命令的参数进行制表符补全。 如果您需要通过 RubyGems 安装的命令使用制表符补全,则需要自己编写和/或安装它。 有关详细信息,请参阅 Bash 参考手册。 您感兴趣的特定命令可能已经有一个完成系统,因此请务必通过 google 搜索它,但通过 RubyGems 安装的大多数命令都没有为其编写的任何自动完成功能。

Executable RubyGem commands are installed into /usr/bin or /usr/local/bin or whatever prefix Ruby is found under. Tab completion for commands should just work just like any other executable file in your PATH. If it's not working, verify that the directory RubyGems installs commands into is in your PATH.

There is currently no official method of doing tab completion for the parameters to any of these commands. If you need tab completion for a command installed via RubyGems, you'll need to write and/or install it yourself. See the Bash reference manual for details. There may already be a completion system for the specific command you're interested in, so be sure to google for it, but most commands installed via RubyGems do not have any auto-complete written for them.

假扮的天使 2024-07-29 13:05:18

尝试:
http://github.com/oggy/ruby-bash-completion
要安装它,只需将 gem 文件复制到 /etc/bash_completion.d/

我在尝试选项卡时遇到错误:

gem install 

因为我在 .gem 目录中没有一些缓存文件。 所以我只是通过编辑gem文件来禁用它。 我更改了 _gem_all_names 函数:

function _gem_all_names {
   echo ""
}

Try:
http://github.com/oggy/ruby-bash-completion
To install it just copy gem file to /etc/bash_completion.d/

I had errors when trying to tab:

gem install 

Because I didn't have some cache files in .gem directory. So I simply disabled it by editing gem file. I changed _gem_all_names function:

function _gem_all_names {
   echo ""
}
仙女 2024-07-29 13:05:18

github 托管的 bash 补全现在是 Ubuntu Lucid Lynx 的一部分。 甜的! 如果您apt-get install ruby​​gems1.8,那么补全(命令和选项!)应该可以正常工作。

不幸的是,安装后,只有看到调用 gem1.8,而不是更方便的 gem,它才会完成。 如果愿意,您可以手动修复此问题,方法是扩展 /etc/bash_completion.d/gem1.8 的最后一行以将 gem 包含为 complete< 的一部分/code> 名单。 我确信有一种更干净的方法,但确实有效。

That github-hosted bash completion is now part of Ubuntu Lucid Lynx. Sweet! If you apt-get install rubygems1.8 then the completion (commands and options!) should just work.

Unfortunately, as installed, it will only complete if it sees invocation of gem1.8, and not the more conventient gem. You can fix that manually if so inclined by extending the last line of /etc/bash_completion.d/gem1.8 to include gem as part of the complete name list. I'm sure there's a cleaner way, but that works.

滿滿的愛 2024-07-29 13:05:18

这已经晚了(几年)了,但是由于我对似乎在网上流传的各种 gem 完成脚本非常不满意,我决定编写自己的(在某种程度上)基于相当不错的脚本。 git-sh 中提供了 git 完成脚本。

https://github.com/pdkl95/rubygems-completion

This is (years) late, but as I was highly unsatisfied with the various completion scripts for gem that seem to be floating around the net, I decided to write my own based (somewhat) on the rather nice git completion script available in git-sh.

https://github.com/pdkl95/rubygems-completion

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文