summaryrefslogtreecommitdiff
path: root/lib/python
diff options
context:
space:
mode:
Diffstat (limited to 'lib/python')
-rw-r--r--lib/python/qmk/cli/__init__.py1
-rw-r--r--lib/python/qmk/cli/git/__init__.py0
-rw-r--r--lib/python/qmk/cli/git/submodule.py22
3 files changed, 23 insertions, 0 deletions
diff --git a/lib/python/qmk/cli/__init__.py b/lib/python/qmk/cli/__init__.py
index a6d53c1cb6..e0ab67da7b 100644
--- a/lib/python/qmk/cli/__init__.py
+++ b/lib/python/qmk/cli/__init__.py
@@ -61,6 +61,7 @@ subcommands = [
'qmk.cli.generate.rgb_breathe_table',
'qmk.cli.generate.rules_mk',
'qmk.cli.generate.version_h',
+ 'qmk.cli.git.submodule',
'qmk.cli.hello',
'qmk.cli.import.kbfirmware',
'qmk.cli.import.keyboard',
diff --git a/lib/python/qmk/cli/git/__init__.py b/lib/python/qmk/cli/git/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/lib/python/qmk/cli/git/__init__.py
diff --git a/lib/python/qmk/cli/git/submodule.py b/lib/python/qmk/cli/git/submodule.py
new file mode 100644
index 0000000000..bcc3868a52
--- /dev/null
+++ b/lib/python/qmk/cli/git/submodule.py
@@ -0,0 +1,22 @@
+import shutil
+from qmk.path import normpath
+
+from milc import cli
+
+REMOVE_DIRS = [
+ 'lib/ugfx',
+ 'lib/pico-sdk',
+ 'lib/chibios-contrib/ext/mcux-sdk',
+ 'lib/lvgl',
+]
+
+
+@cli.subcommand('Git Submodule actions.')
+def git_submodule(cli):
+ for folder in REMOVE_DIRS:
+ if normpath(folder).is_dir():
+ print(f"Removing '{folder}'")
+ shutil.rmtree(folder)
+
+ cli.run(['git', 'submodule', 'sync', '--recursive'], capture_output=False)
+ cli.run(['git', 'submodule', 'update', '--init', '--recursive', '--progress'], capture_output=False)