<jupyter_start><jupyter_text>cli> Command Line Interfaces (CLI)<jupyter_code>#hide
from nbdev.showdoc import *
#export
import argparse
from easyrelease.utils import (
    check_project_root, 
    write_settings_ini, 
    write_setup_py, 
    write_conda_build_scripts,
    update_gitignore,
    run_tests
)
from easyrelease.gh import write_gh_template, make_gh_release
#export
def init_configs():
    "Write initial configs to project root directory"
    parser = argparse.ArgumentParser(description="Initialize project")
    parser.add_argument(
        "project_type",
        help="Either application or package"
    )
    project_type = parser.parse_args().project_type
    # validate input
    if project_type not in ("application", "package"):
        raise Exception(f"Input project_type {project_type} is not valid")
    write_gh_template()
    write_settings_ini(project_type)
    update_gitignore()
    if project_type == "package":
        write_setup_py()
        write_conda_build_scripts()
#export
@run_tests
def make_gh_release_cli():
    "CLI for making GitHub releases"
    parser = argparse.ArgumentParser(description="Make a GitHub release")
    parser.add_argument(
        "-d",
        "--draft",
        action="store_true",
        help="Is this a release draft?"
    )
    parser.add_argument(
        "-p",
        "--prerelease",
        action="store_true",
        help="Is this a prerelease?"
    )    
    args = parser.parse_args()
    make_gh_release(draft=args.draft, prerelease=args.prerelease)
#hide
from nbdev.export import notebook2script
notebook2script()<jupyter_output>Converted 00_gh.ipynb.
Converted 04_utils.ipynb.
Converted index.ipynb.
{'fraction_non_alphanumeric': 0.09339678762641285, 'fraction_numerical': 0.003569303985722784, 'mean_word_length': 3.620879120879121, 'pattern_counts': {'":': 1, '<': 4, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '562481', 'license': 'Apache-2.0', 'n_tokens_mistral': 531, 'n_tokens_neox': 517, 'n_words': 115, 'path': 'nbs/03_cli.ipynb', 'repo_name': 'PabloRMira/easyrelease', 'size': '1681'}