Add --force option to override directory

This commit is contained in:
ines 2017-03-21 02:05:34 +01:00
parent 8eb9a2b355
commit 448a916d0d
2 changed files with 5 additions and 4 deletions

View File

@ -61,16 +61,17 @@ class CLI(object):
@plac.annotations(
input_dir=("directory with model data", "positional", None, str),
output_dir=("output directory", "positional", None, str)
output_dir=("output directory", "positional", None, str),
force=("force overwriting of existing output directory", "flag", "f", bool)
)
def package(self, input_dir, output_dir):
def package(self, input_dir, output_dir, force=False):
"""
Generate Python package for model data, including meta and required
installation files. A new directory will be created in the specified
output directory, and model data will be copied over.
"""
cli_package(input_dir, output_dir)
cli_package(input_dir, output_dir, force)
def __missing__(self, name):

View File

@ -9,7 +9,7 @@ from .. import about
from .. import util
def package(input_dir, output_dir):
def package(input_dir, output_dir, force):
input_path = Path(input_dir)
output_path = Path(output_dir)
check_dirs(input_path, output_path)