[Improvement]: Add directory content validation for bal clean --target-dir <path>
option
#42695
Labels
needTriage
The issue has to be inspected and labeled manually
Type/Improvement
userCategory/Compilation
Description
As of now it is possible to delete any directory and its contents using
bal clean --target-dir <path>
command. Following is the emitted output forbal clean --help
command,Describe your problem(s)
Since the help description says,
Remove the 'target' directory created during the build
, thebal clean
command should be limited to ballerina related directories. Some users might mistakenly provide the project directory instead of the target directory for thebal clean --target-dir <path>
and get the project directory deleted.Describe your solution(s)
It is possible to do a content validation before deleting the provided directory. We can check whether a
bin\
directory is present inside the given target directory. If such a directory is not present or if there are unrecognized subdirectories we can halt the deletion and ask for verification in the CLI.Related area
-> Compilation
Related issue(s) (optional)
No response
Suggested label(s) (optional)
No response
Suggested assignee(s) (optional)
No response
The text was updated successfully, but these errors were encountered: