#!/usr/bin/env python

import argparse

import leo_fw
from leo_fw.board import BoardType

parser = argparse.ArgumentParser(description="Flash firmware to board.")

parser.add_argument("firmware_path", help="path to the firmware binary.")
parser.add_argument(
    "-s",
    "--skip-check",
    dest="check_version",
    action="store_false",
    help="skip checking the current firmware version",
)
parser.add_argument(
    "-b",
    "--board",
    dest="board_type",
    type=BoardType,
    choices=list(BoardType),
    help="explicitly select the board type",
)

args = parser.parse_args()

leo_fw.flash_firmware(
    firmware_path=args.firmware_path,
    board_type=args.board_type,
    check_version=args.check_version,
)
