-
Notifications
You must be signed in to change notification settings - Fork 974
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
slither: implement shell completions with shtab
#2317
base: dev
Are you sure you want to change the base?
Conversation
Important Auto Review SkippedDraft detected. Please check the settings in the CodeRabbit UI or the To trigger a single review, invoke the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
591a63d
to
5a3a2f8
Compare
These can be generated by running e.g. `slither --print-completion zsh` and installed as usual. Closes #2055
941b6f6
to
ef57c2e
Compare
Sample Homebrew patch to generate and install these new completions (keep this in mind as well): diff --git a/Formula/s/slither-analyzer.rb b/Formula/s/slither-analyzer.rb
index d8e1b9a97cb..6ac645f6c3d 100644
--- a/Formula/s/slither-analyzer.rb
+++ b/Formula/s/slither-analyzer.rb
@@ -7,7 +7,7 @@ class SlitherAnalyzer < Formula
sha256 "d01ad88a7fc9581f717859c66d01ef1658ba49505c60e89d5cf38ce6a7f4cdff"
license "AGPL-3.0-only"
revision 1
- head "https://github.com/crytic/slither.git", branch: "master"
+ head "https://github.com/crytic/slither.git", branch: "dev-autocompletion"
bottle do
rebuild 3
@@ -179,6 +179,11 @@ class SlitherAnalyzer < Formula
sha256 "0210b2668f24c078307260bf88bdac9d6f1093635df5123789bfee4d8d7fc8e7"
end
+ resource "shtab" do
+ url "https://files.pythonhosted.org/packages/14/0e/ce211daf7b28fe685b1c9a21d943b3a1c4f300a07e6c59d8765c5f22eb06/shtab-1.6.5.tar.gz"
+ sha256 "cf4ab120183e84cce041abeb6f620f9560739741dfc31dd466315550c08be9ec"
+ end
+
resource "toolz" do
url "https://files.pythonhosted.org/packages/3e/bf/5e12db234df984f6df3c7f12f1428aa680ba4e101f63f4b8b3f9e8d2e617/toolz-0.12.1.tar.gz"
sha256 "ecca342664893f177a13dac0e6b41cbd8ac25a358e5f215316d43e2100224f4d"
@@ -223,6 +228,18 @@ class SlitherAnalyzer < Formula
site_packages = Language::Python.site_packages("python3.12")
paths = %w[crytic-compile solc-select].map { |p| Formula[p].opt_libexec/site_packages }
(libexec/site_packages/"homebrew-deps.pth").write paths.join("\n")
+
+ bin.each_child do |tool|
+ # simil requires optional dependency
+ next if tool == bin/"slither-simil"
+
+ generate_completions_from_executable(
+ tool,
+ shell_parameter_format: "--print-completion=",
+ shells: [:bash, :zsh],
+ base_name: tool.basename.to_s
+ )
+ end
end
test do
|
Is this ready to go? |
@0xalpharush I think so! some more testing would be appreciated though |
@elopez is this still a draft? |
These can be generated by running e.g.
slither --print-completion zsh
and installed as usual.Closes #2055