# Path: confduino/proglist.py
# def programmers_txt():
#     """path of programmers.txt."""
#     x = arduino_path() / 'hardware' / 'arduino' / 'programmers.txt'
#     assert x.exists()
#     return x


from confduino.proglist import programmers_txt
from entrypoint2 import entrypoint
import logging

log = logging.getLogger(__name__)


@entrypoint
def remove_programmer(programmer_id):
    """remove programmer.

    :param programmer_id: programmer id (e.g. 'avrisp')
    :rtype: None

    """

    log.debug('remove %s', programmer_id)
    lines = programmers_txt().lines()
    lines = filter(
        lambda x: not x.strip().startswith(programmer_id + '.'), lines)

# Path: confduino/proglist.py
# def programmers_txt():
#     """path of programmers.txt."""
#     x = arduino_path() / 'hardware' / 'arduino' / 'programmers.txt'
#     assert x.exists()
#     return x


# Path: confduino/progremove.py
from confduino.proglist import programmers_txt
from entrypoint2 import entrypoint
import logging


log = logging.getLogger(__name__)


@entrypoint
def remove_programmer(programmer_id):
    """remove programmer.

    :param programmer_id: programmer id (e.g. 'avrisp')
    :rtype: None

    """

    log.debug('remove %s', programmer_id)
    lines = programmers_txt().lines()
    lines = filter(
        lambda x: not x.strip().startswith(programmer_id + '.'), lines)

    programmers_txt().write_lines(lines)