Skip to content

Commit ab528d1

Browse files
committed
refactor(CLI): use new execute_safetx_flag option to standardize
1 parent 623f2e9 commit ab528d1

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

ape_safe/_cli/modules.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from ape.cli import ConnectedProviderCommand, account_option, ape_cli_context
33
from ape.types import AddressType
44

5-
from ape_safe._cli.click_ext import safe_argument
5+
from ape_safe.cli import execute_safetx_flag, safe_argument
66

77

88
@click.group()
@@ -35,29 +35,29 @@ def guard(safe):
3535
@ape_cli_context()
3636
@account_option()
3737
@safe_argument
38-
@click.option("--propose", is_flag=True, default=False)
38+
@execute_safetx_flag()
3939
@click.argument("module")
40-
def enable(cli_ctx, safe, account, module, propose):
40+
def enable(cli_ctx, safe, account, module, execute_safetx):
4141
"""
4242
Enable MODULE for SAFE
4343
4444
**WARNING**: This is a potentially destructive action and may make your safe vulnerable.
4545
"""
4646
module = cli_ctx.conversion_manager.convert(module, AddressType)
47-
safe.modules.enable(module, submitter=account, propose=propose)
47+
safe.modules.enable(module, submitter=account, propose=not execute_safetx)
4848

4949

5050
@modules.command(cls=ConnectedProviderCommand)
5151
@ape_cli_context()
5252
@account_option()
5353
@safe_argument
54-
@click.option("--propose", is_flag=True, default=False)
54+
@execute_safetx_flag()
5555
@click.argument("module")
56-
def disable(cli_ctx, safe, account, module, propose):
56+
def disable(cli_ctx, safe, account, module, execute_safetx):
5757
"""
5858
Disable MODULE for SAFE
5959
6060
**WARNING**: This is a potentially destructive action and may impact operations of your safe.
6161
"""
6262
module = cli_ctx.conversion_manager.convert(module, AddressType)
63-
safe.modules.disable(module, submitter=account, propose=propose)
63+
safe.modules.disable(module, submitter=account, propose=not execute_safetx)

ape_safe/_cli/safe_mgmt.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
from ape.exceptions import ChainError, ProviderNotConnectedError
1010
from eth_typing import ChecksumAddress
1111

12-
from ape_safe._cli.click_ext import SafeCliContext, safe_argument, safe_cli_ctx
12+
from ape_safe._cli.click_ext import SafeCliContext, safe_cli_ctx
13+
from ape_safe.cli import safe_argument
1314
from ape_safe.client import SafeClient
1415
from ape_safe.exceptions import NoVersionDetected
1516

0 commit comments

Comments
 (0)