Resolve keyboard_aliases when processing keyboard make targets (#24834)
This commit is contained in:
		
							parent
							
								
									db68fd88bd
								
							
						
					
					
						commit
						0c14fc3a21
					
				
					 3 changed files with 41 additions and 12 deletions
				
			
		| 
						 | 
				
			
			@ -82,6 +82,7 @@ subcommands = [
 | 
			
		|||
    'qmk.cli.new.keymap',
 | 
			
		||||
    'qmk.cli.painter',
 | 
			
		||||
    'qmk.cli.pytest',
 | 
			
		||||
    'qmk.cli.resolve_alias',
 | 
			
		||||
    'qmk.cli.test.c',
 | 
			
		||||
    'qmk.cli.userspace.add',
 | 
			
		||||
    'qmk.cli.userspace.compile',
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										16
									
								
								lib/python/qmk/cli/resolve_alias.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								lib/python/qmk/cli/resolve_alias.py
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,16 @@
 | 
			
		|||
from qmk.keyboard import keyboard_folder
 | 
			
		||||
 | 
			
		||||
from milc import cli
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@cli.argument('--allow-unknown', arg_only=True, action='store_true', help="Return original if rule is not a valid keyboard.")
 | 
			
		||||
@cli.argument('keyboard', arg_only=True, help='The keyboard\'s name')
 | 
			
		||||
@cli.subcommand('Resolve DEFAULT_FOLDER and any keyboard_aliases for provided rule')
 | 
			
		||||
def resolve_alias(cli):
 | 
			
		||||
    try:
 | 
			
		||||
        print(keyboard_folder(cli.args.keyboard))
 | 
			
		||||
    except ValueError:
 | 
			
		||||
        if cli.args.allow_unknown:
 | 
			
		||||
            print(cli.args.keyboard)
 | 
			
		||||
        else:
 | 
			
		||||
            raise
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue