From 6b364a9ffdf58e69e7f42bb69c124a083c585c2f Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
Date: Fri, 12 Mar 2021 16:26:09 -0500
Subject: [PATCH] build.py: Add a clean action.

Change-Id: Iba8aac10fa36e4404b07beab9dfe9ed3d8c5c1a2
---
 build.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/build.py b/build.py
index 3dc73a11..f08cba54 100755
--- a/build.py
+++ b/build.py
@@ -426,6 +426,12 @@ def run_uninstall(args):
             ]
             execute_script(UNINSTALL_LRC)
 
+
+def run_clean():
+    execute_script(['git clean -xfdd',
+                    'git submodule foreach git clean -xfdd'])
+
+
 def run_run(args):
     if args.distribution == OSX_DISTRIBUTION_NAME:
         subprocess.Popen(
@@ -575,6 +581,10 @@ def parse_args():
     ga.add_argument(
         '--install', action='store_true',
         help='Build and install Ring')
+    ga.add_argument(
+        '--clean', action='store_true',
+        help='Call "git clean" on every repository of the project'
+    )
     ga.add_argument(
         '--uninstall', action='store_true',
         help='Uninstall Ring')
@@ -649,6 +659,8 @@ def main():
 
     elif parsed_args.init:
         run_init()
+    elif parsed_args.clean:
+        run_clean()
 
     elif parsed_args.install:
         run_install(parsed_args)
-- 
GitLab