Skip to content

Commit

Permalink
apio drivers refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Obijuan committed Mar 17, 2024
1 parent a849743 commit d0395e8
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions apio/commands/drivers.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,41 @@
# -*- coding: utf-8 -*-
# -- This file is part of the Apio project
# -- (C) 2016-2019 FPGAwars
# -- Author Jesús Arroyo
# -- (C) 2016-2024 FPGAwars
# -- Authors
# -- * Jesús Arroyo (2016-2019)
# -- * Juan Gonzalez (obijuan) (2019-2024)
# -- Licence GPLv2
"""Main implementation of APIO DRIVERS command"""

import click

from apio.managers.drivers import Drivers
from apio import util

# ------------------
# -- CONSTANTS
# ------------------
CMD = "drivers" # -- Comand name
FTDI_ENABLE = "ftdi_enable" # -- Option
FTDI_DISABLE = "ftdi_disable" # -- Option
SERIAL_ENABLE = "serial_enable" # -- Option
SERIAL_DISABLE = "serial_disable" # -- Option


@click.command("drivers", context_settings=util.context_settings())
@click.command(CMD, context_settings=util.context_settings())
@click.pass_context
@click.option("--ftdi-enable", is_flag=True, help="Enable FTDI drivers.")
@click.option("--ftdi-disable", is_flag=True, help="Disable FTDI drivers.")
@click.option("--serial-enable", is_flag=True, help="Enable Serial drivers.")
@click.option("--serial-disable", is_flag=True, help="Disable Serial drivers.")
def cli(
ctx,
ftdi_enable: bool,
ftdi_disable: bool,
serial_enable: bool,
serial_disable: bool,
):
def cli(ctx, **kwargs):
"""Manage FPGA boards drivers."""

# -- Extract the arguments
ftdi_enable = kwargs[FTDI_ENABLE]
ftdi_disable = kwargs[FTDI_DISABLE]
serial_enable = kwargs[SERIAL_ENABLE]
serial_disable = kwargs[SERIAL_DISABLE]

# -- Access to the Drivers
drivers = Drivers()

Expand Down

0 comments on commit d0395e8

Please sign in to comment.