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

[token-cli] Fix panicking behavior from sign_only #7527

Merged
merged 1 commit into from
Nov 27, 2024

Conversation

samkim-crypto
Copy link
Contributor

@samkim-crypto samkim-crypto commented Nov 26, 2024

Problem

In clap v2, the ArgMatches::is_present(ARG_NAME) function returns None when ARG_NAME is not defined in the clap app. In clap v3, ArgMatches::is_present(ARG_NAME) panics of ARG_NAME is not defined in the clap app.

I thought I fixed all occurrences of is_present that could panic in the token-cli, but it seems that I missed one place when we parse for Config.

`sign_only` is not an id of an argument or a group.
Make sure you're using the name of the argument itself and not the name of short or long flags.
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Summary of Changes

Replace is_present with try_contains_id that does not panic.

@samkim-crypto samkim-crypto marked this pull request as ready for review November 27, 2024 02:28
Copy link
Contributor

@joncinque joncinque left a comment

Choose a reason for hiding this comment

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

Makes sense, thanks!

@samkim-crypto samkim-crypto merged commit dcfc02b into solana-labs:master Nov 27, 2024
61 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants