Add export, temporary eth plugin inline

This commit is contained in:
nolash
2021-10-09 21:04:11 +02:00
parent 546a4d912a
commit 388c676d11
10 changed files with 76 additions and 3 deletions

40
cic/cmd/export.py Normal file
View File

@@ -0,0 +1,40 @@
# 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
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)
cp = Proof(path=eargs.directory)
cm = Meta(path=eargs.directory)
ca = Attachment(path=eargs.directory)
cn = Network(eargs.directory)
cp.load()
cm.load()
ca.load()
cn.load()
ref = cn.reference(eargs.target)
logg.debug('found reference {} for target {}'.format(ref, eargs.target))
getattr(cmd_mod, 'new')(ref, ca.get())

View File

@@ -7,7 +7,6 @@ from cic import Proof
from cic.meta import Meta
from cic.attachment import Attachment
from cic.network import Network
logg = logging.getLogger(__name__)

View File

@@ -7,7 +7,7 @@ from cic.network import Network
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='directory')
argparser.add_argument('-d', '--directory', type=str, dest='directory', default='.', help='cic data directory')
def validate_args(args):