The only way to have the dir task be cleaned is to explicitly specify its name on the command-line, i.e. doit clean dir.
Environment
OS: Linux Debian Bullseye 11.5
python version: 3.9.2
doit version: 0.36.0
Proposed fix
The following change seems to fix the issue for me
diff --git a/doit/cmd_clean.py b/doit/cmd_clean.py
index 7cdc90a..899b88d 100644
--- a/doit/cmd_clean.py
+++ b/doit/cmd_clean.py
@@ -99,7 +99,7 @@ class Clean(DoitCmdBase):
else:
# if not cleaning specific task enable clean_dep automatically
cleandep = True
- if self.sel_tasks is not None:
+ if self.sel_tasks is not None and not cleanall:
clean_list = self._expand(self.sel_tasks) # default tasks from config
else:
clean_list = [t.name for t in self.task_list]
Bug description
When there's the
default_tasks
specified in thedodo.py
file, thedoit clean --clean-all
doesn't clean all targets.The only way to have the
dir
task be cleaned is to explicitly specify its name on the command-line, i.e.doit clean dir
.Environment
Proposed fix
The following change seems to fix the issue for me