INNER CODE UNIT · Python

create

infosecB/LOOBins · src/pyloobins/cli.py:43

def create(name: str, path: str) -> None:
    """Create a YAML template file for a new LOOBin."""
    template = make_template(name=name).to_yaml()
    file_name = normalize_file_name(name) if name else "template"
    if path and not os.path.exists(path):
        click.echo(
            f"The specified path did not exist. "
            f"Creating the {file_name}.yml file in the current directory."
        )
    file_path = path if path and os.path.exists(path) else "./"
    with open(
        file=os.path.join(file_path, f"{file_name}.yml"),
        mode="w",
        encoding="utf-8",
    ) as out_file:
        out_file.write(template)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…