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: issue where --account did not fail when it was supposed to #2231

Merged
merged 2 commits into from
Aug 22, 2024

Conversation

antazoey
Copy link
Member

What I did

an annoying issue where if i mis-typed an alias, even when using the --account flag, it would prompt... id then enter the wrong alias again in the prompt but instead of failing, it would treat it as None and try to use it in my script , None has no attribute deploy

How I did it

fail if we resolve to an alias but that alias does not exist in your accounts

How to verify it

have a script like:

import click
from ape.cli import ConnectedProviderCommand, account_option, ape_cli_context


@click.command(cls=ConnectedProviderCommand)
@ape_cli_context()
@account_option()
def cli(cli_ctx, account):
    """
    Deploy the chess contract.
    """
    chess_contract = cli_ctx.local_project.chess
    account.deploy(chess_contract)

run it with a nonsense account like:

ape run deploy --account "SADFASDFG

should get some output like;

Try 'ape run deploy -h' for help.

Error: Invalid value for '--account': Account with alias 'SADFASDFG' not found.

Checklist

  • All changes are completed
  • New test cases have been added
  • Documentation has been updated

@antazoey antazoey merged commit d933b00 into ApeWorX:main Aug 22, 2024
16 checks passed
@antazoey antazoey deleted the fix/account-option-not-failing branch August 22, 2024 13:41
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