summaryrefslogtreecommitdiffstats
path: root/lib/python/qmk/cli/git/submodule.py
blob: bcc3868a521350b609ec48f2fac8f177933c0934 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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)