fix: throw if directory exsists
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -4,13 +4,8 @@ import logging
|
||||
import os
|
||||
from typing import List
|
||||
|
||||
|
||||
# external imports
|
||||
from cic_types.ext.metadata import MetadataRequestsHandler
|
||||
from cic_types.ext.metadata.signer import Signer as MetadataSigner
|
||||
from chainlib.chain import ChainSpec
|
||||
from chainlib.cli.config import Config
|
||||
|
||||
# Local Modules
|
||||
from cic.contract.components.attachment import Attachment
|
||||
from cic.contract.components.meta import Meta
|
||||
@@ -20,8 +15,9 @@ from cic.contract.helpers import init_writers_from_config
|
||||
from cic.contract.network import Network
|
||||
from cic.contract.processor import ContractProcessor
|
||||
from cic.writers import HTTPWriter, KeyedWriterFactory, MetadataWriter
|
||||
|
||||
|
||||
# external imports
|
||||
from cic_types.ext.metadata import MetadataRequestsHandler
|
||||
from cic_types.ext.metadata.signer import Signer as MetadataSigner
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@@ -74,16 +70,6 @@ def load_contract(directory) -> Contract:
|
||||
def generate_contract(
|
||||
directory: str, targets: List[str], config, interactive=True
|
||||
) -> Contract:
|
||||
if os.path.exists(directory):
|
||||
contine = input(
|
||||
f"Directory {directory} already exists, Would you like to delete it? (y/n): "
|
||||
)
|
||||
if contine.lower() != "y":
|
||||
log.debug("Trying to load existing contract")
|
||||
return load_contract(directory)
|
||||
else:
|
||||
print(f"Deleted {directory}")
|
||||
os.system(f"rm -rf {directory}")
|
||||
os.makedirs(directory)
|
||||
log.info("Generating token")
|
||||
token = Token(directory, interactive=interactive)
|
||||
|
||||
Reference in New Issue
Block a user