Skip to content
Snippets Groups Projects
Commit 07ffd290 authored by Moul's avatar Moul
Browse files

[mod] #140: Change argument name for better --help

To know that an uid and a pubkey can be passed as argument
It is not possible to add an help on argument() as for option()
https://click.palletsprojects.com/en/7.x/arguments/
parent 6abc9dcd
No related branches found
No related tags found
2 merge requests!146Merge dev into master branch to complete v0.8.0 development cycle,!140Membership, choose_identity, pendulum, asynctest dependencies
...@@ -33,12 +33,12 @@ from silkaj.constants import SUCCESS_EXIT_STATUS ...@@ -33,12 +33,12 @@ from silkaj.constants import SUCCESS_EXIT_STATUS
@command("cert", help="Send certification") @command("cert", help="Send certification")
@argument("id_to_certify") @argument("uid_pubkey_to_certify")
@coroutine @coroutine
async def send_certification(id_to_certify): async def send_certification(uid_pubkey_to_certify):
client = ClientInstance().client client = ClientInstance().client
idty_to_certify, pubkey_to_certify, send_certs = await wot.choose_identity( idty_to_certify, pubkey_to_certify, send_certs = await wot.choose_identity(
id_to_certify uid_pubkey_to_certify
) )
# Authentication # Authentication
......
...@@ -49,9 +49,9 @@ def get_sent_certifications(signed, time_first_block, params): ...@@ -49,9 +49,9 @@ def get_sent_certifications(signed, time_first_block, params):
"wot", "wot",
help="Check received and sent certifications and consult the membership status of any given identity", help="Check received and sent certifications and consult the membership status of any given identity",
) )
@click.argument("id") @click.argument("uid_pubkey")
@coroutine @coroutine
async def received_sent_certifications(id): async def received_sent_certifications(uid_pubkey):
""" """
get searched id get searched id
get id of received and sent certifications get id of received and sent certifications
...@@ -60,7 +60,7 @@ async def received_sent_certifications(id): ...@@ -60,7 +60,7 @@ async def received_sent_certifications(id):
client = ClientInstance().client client = ClientInstance().client
first_block = await client(blockchain.block, 1) first_block = await client(blockchain.block, 1)
time_first_block = first_block["time"] time_first_block = first_block["time"]
identity, pubkey, signed = await choose_identity(id) identity, pubkey, signed = await choose_identity(uid_pubkey)
certifications = OrderedDict() certifications = OrderedDict()
params = await BlockchainParams().params params = await BlockchainParams().params
req = await client(wot.requirements, pubkey) req = await client(wot.requirements, pubkey)
...@@ -83,7 +83,7 @@ async def received_sent_certifications(id): ...@@ -83,7 +83,7 @@ async def received_sent_certifications(id):
nbr_sent_certs = len(certifications["sent"]) if "sent" in certifications else 0 nbr_sent_certs = len(certifications["sent"]) if "sent" in certifications else 0
print( print(
"{0} ({1}) from block #{2}\nreceived {3} and sent {4}/{5} certifications:\n{6}\n{7}\n".format( "{0} ({1}) from block #{2}\nreceived {3} and sent {4}/{5} certifications:\n{6}\n{7}\n".format(
id, identity["uid"],
pubkey[:5] + "", pubkey[:5] + "",
identity["meta"]["timestamp"][:15] + "", identity["meta"]["timestamp"][:15] + "",
len(certifications["received"]), len(certifications["received"]),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment