fixed cli choices, added help messages

pull/617/head
Yhtyyar Sahatov 2022-05-26 15:22:09 +03:00
rodzic 5d31b8d58a
commit 181d1769a0
3 zmienionych plików z 5 dodań i 17 usunięć

Wyświetl plik

@ -173,10 +173,7 @@ def main():
"--blockchain_type",
type=str,
required=True,
choices=[
AvailableBlockchainType.ETHEREUM.value,
AvailableBlockchainType.POLYGON.value,
],
help=f"Available blockchain types: {[member.value for member in AvailableBlockchainType]}",
)
crawl_parser.add_argument(
"--abi",

Wyświetl plik

@ -43,8 +43,6 @@ def handle_crawl(args: argparse.Namespace) -> None:
f"Initial function call crawl jobs count: {len(initial_function_call_jobs)}"
)
# Couldn't figure out how to convert from string to AvailableBlockchainType
# AvailableBlockchainType(args.blockchain_type) is not working
blockchain_type = AvailableBlockchainType(args.blockchain_type)
logger.info(f"Blockchain type: {blockchain_type.value}")
@ -128,11 +126,7 @@ def main() -> None:
"--blockchain-type",
"-b",
type=str,
choices=[
AvailableBlockchainType.ETHEREUM.value,
AvailableBlockchainType.POLYGON.value,
],
required=True,
help=f"Available blockchain types: {[member.value for member in AvailableBlockchainType]}",
)
crawl_parser.add_argument(
"--web3",

Wyświetl plik

@ -83,9 +83,7 @@ def handle_materialize(args: argparse.Namespace) -> None:
with yield_db_session_ctx() as db_session, contextlib.closing(
sqlite3.connect(args.datastore)
) as moonstream_datastore:
last_saved_block = get_last_saved_block(
moonstream_datastore, args.blockchain.value
)
last_saved_block = get_last_saved_block(moonstream_datastore, args.blockchain)
logger.info(f"Last saved block: {last_saved_block}")
if last_saved_block and last_saved_block >= bounds.starting_block:
logger.info(
@ -173,9 +171,8 @@ def main() -> None:
parser_materialize.add_argument(
"--blockchain",
type=AvailableBlockchainType,
choices=[AvailableBlockchainType.ETHEREUM, AvailableBlockchainType.POLYGON],
help="Blockchain to use",
type=str,
help=f"Available blockchain types: {[member.value for member in AvailableBlockchainType]}",
)
parser_materialize.set_defaults(func=handle_materialize)