Skip to content

Commit

Permalink
apio clean refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Obijuan committed Mar 17, 2024
1 parent f0503b4 commit 4f2b462
Showing 1 changed file with 25 additions and 10 deletions.
35 changes: 25 additions & 10 deletions apio/commands/clean.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
"""Main implementation of APIO CLEAN command"""

# -*- 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 CLEAN command"""

from pathlib import Path

from pathlib import Path
import click

from apio.managers.scons import SCons
from apio import util

# ------------------
# -- CONSTANTS
# ------------------
CMD = "clean" # -- Comand name
BOARD = "board" # -- Option
PROJECT_DIR = "project_dir" # -- Option
VERBOSE = "verbose" # -- Option


@click.command("clean", context_settings=util.context_settings())
@click.command(CMD, context_settings=util.context_settings())
@click.pass_context
@click.option(
"-p",
Expand All @@ -23,16 +31,23 @@
metavar="str",
help="Set the target directory for the project.",
)
@click.option("-b", "--board", type=str, metavar="str", help="Set the board.")
@click.option(
"-b", f"--{BOARD}", type=str, metavar="str", help="Set the board."
)
@click.option(
"-v",
"--verbose",
f"--{VERBOSE}",
is_flag=True,
help="Show the entire output of the command.",
)
def cli(ctx, board, project_dir, verbose):
def cli(ctx, **kwargs):
"""Clean the previous generated files."""

# -- Extract the arguments
project_dir = kwargs[PROJECT_DIR]
board = kwargs[BOARD]
verbose = kwargs[VERBOSE]

# -- Create the scons object
scons = SCons(project_dir)

Expand Down

0 comments on commit 4f2b462

Please sign in to comment.