reorder help

This commit is contained in:
callebtc
2022-12-27 19:47:46 +01:00
parent f682e95b8f
commit 1969abae5f

View File

@@ -521,6 +521,31 @@ async def invoices(ctx):
print("No invoices found.") print("No invoices found.")
@cli.command("wallets", help="List of all available wallets.")
@click.pass_context
@coro
async def wallets(ctx):
# list all directories
wallets = [d for d in listdir(CASHU_DIR) if isdir(join(CASHU_DIR, d))]
try:
wallets.remove("mint")
except ValueError:
pass
for w in wallets:
wallet = Wallet(ctx.obj["HOST"], os.path.join(CASHU_DIR, w))
try:
await init_wallet(wallet)
if wallet.proofs and len(wallet.proofs):
active_wallet = False
if w == ctx.obj["WALLET_NAME"]:
active_wallet = True
print(
f"Wallet: {w}\tBalance: {sum_proofs(wallet.proofs)} sat (available: {sum_proofs([p for p in wallet.proofs if not p.reserved])} sat){' *' if active_wallet else ''}"
)
except:
pass
@cli.command("nsend", help="Send tokens via nostr.") @cli.command("nsend", help="Send tokens via nostr.")
@click.argument("amount", type=int) @click.argument("amount", type=int)
@click.argument( @click.argument(
@@ -614,31 +639,6 @@ async def nreceive(ctx, verbose: bool):
t.start() t.start()
@cli.command("wallets", help="List of all available wallets.")
@click.pass_context
@coro
async def wallets(ctx):
# list all directories
wallets = [d for d in listdir(CASHU_DIR) if isdir(join(CASHU_DIR, d))]
try:
wallets.remove("mint")
except ValueError:
pass
for w in wallets:
wallet = Wallet(ctx.obj["HOST"], os.path.join(CASHU_DIR, w))
try:
await init_wallet(wallet)
if wallet.proofs and len(wallet.proofs):
active_wallet = False
if w == ctx.obj["WALLET_NAME"]:
active_wallet = True
print(
f"Wallet: {w}\tBalance: {sum_proofs(wallet.proofs)} sat (available: {sum_proofs([p for p in wallet.proofs if not p.reserved])} sat){' *' if active_wallet else ''}"
)
except:
pass
@cli.command("info", help="Information about Cashu wallet.") @cli.command("info", help="Information about Cashu wallet.")
@click.pass_context @click.pass_context
@coro @coro