Migrate 'make git-submodule' to CLI command (#19479)
This commit is contained in:
		
							parent
							
								
									3a5a4c708f
								
							
						
					
					
						commit
						b297531dbf
					
				
					 5 changed files with 25 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -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',
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										0
									
								
								lib/python/qmk/cli/git/__init__.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								lib/python/qmk/cli/git/__init__.py
									
										
									
									
									
										Normal file
									
								
							
							
								
								
									
										22
									
								
								lib/python/qmk/cli/git/submodule.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								lib/python/qmk/cli/git/submodule.py
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -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)
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue