Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

token-cli: Add check withdraw-withheld-tokens has sources or include mint #7152

Merged
merged 1 commit into from
Aug 16, 2024

Conversation

zzau13
Copy link
Contributor

@zzau13 zzau13 commented Aug 15, 2024

Just check both conditions and return error. Clap doesn't have the method for check that, so I do check in command logic.
Fixes #7042

@mergify mergify bot added the community Community contribution label Aug 15, 2024
@joncinque
Copy link
Contributor

I pointed out how to do this with clap using an ArgGroup, could you switch it to that? We can do:

                .group(
                    ArgGroup::with_name("source_or_mint")
                        .arg("source")
                        .arg("include_mint")
                        .multiple(true)
                        .required(true)
                )

This gives a nice error message:

$ spl-token withdraw-withheld-tokens AqANLp9HPtk9Lc1qpMSH9ijqMxMXKvFCEdg8M3P3Mi6X
error: The following required arguments were not provided:
    <source|--include-mint>

USAGE:
    spl-token withdraw-withheld-tokens [FLAGS] [OPTIONS] <TOKEN_ACCOUNT_ADDRESS> <source|--include-mint> [--]

For more information try --help

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.

Thanks for your contribution!

@joncinque joncinque merged commit 58dd83b into solana-labs:master Aug 16, 2024
31 checks passed
@joncinque joncinque changed the title Add check withdraw-withheld-tokens has sources or include mint token-cli: Add check withdraw-withheld-tokens has sources or include mint Aug 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
community Community contribution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

token-cli: withdraw-withheld-tokens silently fails
2 participants