mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2024-11-11 01:28:17 +03:00
0d1c3a235f
* cli: Use correct type annotations * cli: Respond to comments * cli: Add more missing Optionals
86 lines
2.1 KiB
Python
86 lines
2.1 KiB
Python
from typing import Optional
|
|
|
|
import click
|
|
|
|
|
|
@click.group("farm", short_help="Manage your farm")
|
|
def farm_cmd() -> None:
|
|
pass
|
|
|
|
|
|
@farm_cmd.command("summary", short_help="Summary of farming information")
|
|
@click.option(
|
|
"-p",
|
|
"--rpc-port",
|
|
help=(
|
|
"Set the port where the Full Node is hosting the RPC interface. "
|
|
"See the rpc_port under full_node in config.yaml"
|
|
),
|
|
type=int,
|
|
default=None,
|
|
show_default=True,
|
|
)
|
|
@click.option(
|
|
"-wp",
|
|
"--wallet-rpc-port",
|
|
help="Set the port where the Wallet is hosting the RPC interface. See the rpc_port under wallet in config.yaml",
|
|
type=int,
|
|
default=None,
|
|
show_default=True,
|
|
)
|
|
@click.option(
|
|
"-hp",
|
|
"--harvester-rpc-port",
|
|
help=(
|
|
"Set the port where the Harvester is hosting the RPC interface"
|
|
"See the rpc_port under harvester in config.yaml"
|
|
),
|
|
type=int,
|
|
default=None,
|
|
show_default=True,
|
|
)
|
|
@click.option(
|
|
"-fp",
|
|
"--farmer-rpc-port",
|
|
help=(
|
|
"Set the port where the Farmer is hosting the RPC interface. " "See the rpc_port under farmer in config.yaml"
|
|
),
|
|
type=int,
|
|
default=None,
|
|
show_default=True,
|
|
)
|
|
def summary_cmd(
|
|
rpc_port: Optional[int],
|
|
wallet_rpc_port: Optional[int],
|
|
harvester_rpc_port: Optional[int],
|
|
farmer_rpc_port: Optional[int],
|
|
) -> None:
|
|
from .farm_funcs import summary
|
|
import asyncio
|
|
|
|
asyncio.run(summary(rpc_port, wallet_rpc_port, harvester_rpc_port, farmer_rpc_port))
|
|
|
|
|
|
@farm_cmd.command("challenges", short_help="Show the latest challenges")
|
|
@click.option(
|
|
"-fp",
|
|
"--farmer-rpc-port",
|
|
help="Set the port where the Farmer is hosting the RPC interface. See the rpc_port under farmer in config.yaml",
|
|
type=int,
|
|
default=None,
|
|
show_default=True,
|
|
)
|
|
@click.option(
|
|
"-l",
|
|
"--limit",
|
|
help="Limit the number of challenges shown. Use 0 to disable the limit",
|
|
type=click.IntRange(0),
|
|
default=20,
|
|
show_default=True,
|
|
)
|
|
def challenges_cmd(farmer_rpc_port: Optional[int], limit: int) -> None:
|
|
from .farm_funcs import challenges
|
|
import asyncio
|
|
|
|
asyncio.run(challenges(farmer_rpc_port, limit))
|