Skip to content

Commit

Permalink
docs: update cli example code (#2220)
Browse files Browse the repository at this point in the history
Co-authored-by: El De-dog-lo <[email protected]>
  • Loading branch information
martinkrung and fubuloubu authored Aug 15, 2024
1 parent 585936f commit 36ff7cc
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions docs/userguides/clis.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,21 @@ Additionally, specify `ecosystem`, `network`, or `provider` in your command func
import click
from ape.cli import ConnectedProviderCommand

@click.command(cls=ConnectedProviderCommand)
def cmd(network, provider):
@click.group()
def cli():
pass

@cli.command(cls=ConnectedProviderCommand)
def cmd_1(network, provider):
click.echo(network.name)
click.echo(provider.is_connected) # True

@click.command(cls=ConnectedProviderCommand)
def cmd(provider):
@cli.command(cls=ConnectedProviderCommand)
def cmd_2(provider):
click.echo(provider.is_connected) # True

@click.command(cls=ConnectedProviderCommand)
def cmd():
@cli.command(cls=ConnectedProviderCommand)
def cmd_3():
click.echo("Using params from ConnectedProviderCommand is optional")
```

Expand Down

0 comments on commit 36ff7cc

Please sign in to comment.