Skip to content
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

fix: fix shell generation panic due to unnecessary 'conflicts_with' #2934

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zilayo
Copy link

@zilayo zilayo commented Sep 14, 2024

Problem

solana completions -s zsh currently panics when trying to generate zsh completions.

The root cause is the below code which defines a conflicting arg buffer_authority for solana program-v4 show, however buffer_authority is not an argument in program-v4 show:

agave/cli/src/program_v4.rs

Lines 277 to 283 in fc0183d

.arg(
Arg::with_name("all")
.long("all")
.conflicts_with("account")
.conflicts_with("buffer_authority")
.help("Show accounts for all authorities"),
)

This results in clap panicking due to find_any_arg returning None, but the calling macro uses expect()

https://github.com/clap-rs/clap/blob/v2.33.3/src/completions/macros.rs#L15
https://github.com/clap-rs/clap/blob/v2.33.3/src/app/parser.rs#L2168-L2179

Summary of Changes

  • Removed .conflicts_with("buffer_authority") from program-v4 show
  • Added a unit test that ensures CLI completion works for all supported shells.

Fixes #2929

@@ -278,7 +278,6 @@ impl ProgramV4SubCommands for App<'_, '_> {
Arg::with_name("all")
.long("all")
.conflicts_with("account")
.conflicts_with("buffer_authority")

Choose a reason for hiding this comment

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

@pgarg66 it's supposed to be .conflicts_with("authority"), right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug] solana completion -s zsh panics
2 participants