add(tasks): implement reset task to clean project state

This commit is contained in:
HendrikRauh 2026-03-05 21:36:40 +01:00
parent cac63b10d7
commit 39d314ccfa

View file

@ -1,4 +1,6 @@
from invoke import task
import os
import shutil
@task
def cleanbuild(c):
@ -38,6 +40,7 @@ def clean(c):
"""Clean build artifacts"""
c.run("idf.py fullclean")
@task
def config(c):
"""Open menuconfig to edit project settings"""
@ -48,3 +51,17 @@ def config(c):
def saveconfig(c):
"""Save current config as sdkconfig.defaults"""
c.run("idf.py save-defconfig")
@task
def reset(c):
"""Reset project to clean state: remove build, config, and managed components"""
if os.path.exists("sdkconfig"):
os.remove("sdkconfig")
if os.path.exists("sdkconfig.old"):
os.remove("sdkconfig.old")
if os.path.exists("build"):
shutil.rmtree("build")
if os.path.exists("managed_components"):
shutil.rmtree("managed_components")