2021-10-09 21:04:11 +02:00
|
|
|
# standard imports
|
|
|
|
import logging
|
|
|
|
import importlib
|
|
|
|
|
|
|
|
# local imports
|
|
|
|
from cic import Proof
|
|
|
|
from cic.meta import Meta
|
|
|
|
from cic.attachment import Attachment
|
|
|
|
from cic.network import Network
|
2021-10-10 14:49:22 +02:00
|
|
|
from cic.token import Token
|
2021-10-09 21:04:11 +02:00
|
|
|
|
|
|
|
logg = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
def process_args(argparser):
|
|
|
|
argparser.add_argument('-d', '--directory', type=str, dest='directory', default='.', help='directory')
|
|
|
|
argparser.add_argument('-y', '--signer', type=str, dest='signer', help='target-specific signer to use for export')
|
|
|
|
argparser.add_argument('target', type=str, help='target network type')
|
|
|
|
|
|
|
|
|
|
|
|
def validate_args(args):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
def execute(config, eargs):
|
|
|
|
modname = 'cic.ext.{}'.format(eargs.target)
|
|
|
|
cmd_mod = importlib.import_module(modname)
|
|
|
|
|
2021-10-10 14:49:22 +02:00
|
|
|
ct = Token(path=eargs.directory)
|
2021-10-09 21:04:11 +02:00
|
|
|
cp = Proof(path=eargs.directory)
|
|
|
|
cm = Meta(path=eargs.directory)
|
|
|
|
ca = Attachment(path=eargs.directory)
|
2021-10-10 14:49:22 +02:00
|
|
|
cn = Network(path=eargs.directory)
|
2021-10-09 21:04:11 +02:00
|
|
|
|
2021-10-10 14:49:22 +02:00
|
|
|
ct.load()
|
2021-10-09 21:04:11 +02:00
|
|
|
cp.load()
|
|
|
|
cm.load()
|
|
|
|
ca.load()
|
|
|
|
cn.load()
|
|
|
|
|
|
|
|
ref = cn.reference(eargs.target)
|
|
|
|
logg.debug('found reference {} for target {}'.format(ref, eargs.target))
|
2021-10-09 21:45:07 +02:00
|
|
|
getattr(cmd_mod, 'new')(ref, ca.get(), signer_hint=eargs.signer)
|