cic-cli/cic/cmd/show.py

49 lines
1.1 KiB
Python
Raw Normal View History

2021-10-09 20:37:54 +02:00
# local imports
2022-03-01 09:17:17 +01:00
from cic.contract.components.proof import Proof
from cic.contract.components.meta import Meta
from cic.contract.components.attachment import Attachment
from cic.contract.network import Network
2022-03-01 09:17:17 +01:00
from cic.contract.components.token import Token
2021-10-09 20:37:54 +02:00
def process_args(argparser):
argparser.add_argument("-f", "--file", type=str, help="add file")
argparser.add_argument(
"-d",
"--directory",
type=str,
dest="directory",
default=".",
help="cic data directory",
)
2021-10-09 20:37:54 +02:00
def validate_args(args):
pass
def execute(config, eargs):
2021-10-10 14:49:22 +02:00
ct = Token(path=eargs.directory)
2021-10-09 20:37:54 +02:00
cp = Proof(path=eargs.directory)
cm = Meta(path=eargs.directory)
ca = Attachment(path=eargs.directory)
cn = Network(eargs.directory)
2021-10-10 14:49:22 +02:00
ct.load()
2021-10-09 20:37:54 +02:00
cp.load()
cm.load()
ca.load()
cn.load()
print(
"""[cic.header]
version = {}\n""".format(
cp.version()
)
)
2021-10-10 14:49:22 +02:00
print("[cic.token]\n{}".format(ct))
print("[cic.proof]\n{}".format(cp))
print("[cic.meta]\n{}".format(cm))
print("[cic.attachment]\n{}".format(ca))
print("[cic.network]\n{}".format(cn))