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

add quiet option #214

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions eth2deposit/cli/generate_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ def generate_keys_arguments_decorator(function: Callable[..., Any]) -> Callable[
'withdrawal credentials. Otherwise, it will generate withdrawal credentials with the '
'mnemonic-derived withdrawal public key.'),
),
click.option(
'--quiet', '-q',
help=('Suppress the output of useless stuff.'),
is_flag=True,
),
]
for decorator in reversed(decorators):
function = decorator(function)
Expand All @@ -124,16 +129,17 @@ def generate_keys_arguments_decorator(function: Callable[..., Any]) -> Callable[
@click.pass_context
def generate_keys(ctx: click.Context, validator_start_index: int,
num_validators: int, folder: str, chain: str, keystore_password: str,
eth1_withdrawal_address: HexAddress, **kwargs: Any) -> None:
eth1_withdrawal_address: HexAddress, quiet: bool = False, **kwargs: Any) -> None:
mnemonic = ctx.obj['mnemonic']
mnemonic_password = ctx.obj['mnemonic_password']
amounts = [MAX_DEPOSIT_AMOUNT] * num_validators
folder = os.path.join(folder, DEFAULT_VALIDATOR_KEYS_FOLDER_NAME)
chain_setting = get_chain_setting(chain)
if not os.path.exists(folder):
os.mkdir(folder)
click.clear()
click.echo(RHINO_0)
if not quiet:
click.clear()
click.echo(RHINO_0)
click.echo('Creating your keys.')
credentials = CredentialList.from_mnemonic(
mnemonic=mnemonic,
Expand All @@ -150,5 +156,6 @@ def generate_keys(ctx: click.Context, validator_start_index: int,
raise ValidationError("Failed to verify the keystores.")
if not verify_deposit_data_json(deposits_file, credentials.credentials):
raise ValidationError("Failed to verify the deposit data JSON files.")
click.echo('\nSuccess!\nYour keys can be found at: %s' % folder)
click.pause('\n\nPress any key.')
if not quiet:
click.echo('\nSuccess!\nYour keys can be found at: %s' % folder)
click.pause('\n\nPress any key.')