mirror of
				https://github.com/mfulz/qmk_firmware.git
				synced 2025-10-31 05:12:33 +01:00 
			
		
		
		
	Add a command to format python code
This commit is contained in:
		
							parent
							
								
									533d6d6a46
								
							
						
					
					
						commit
						deb6fa6a87
					
				
							
								
								
									
										16
									
								
								lib/python/qmk/cli/pyformat.py
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										16
									
								
								lib/python/qmk/cli/pyformat.py
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,16 @@ | ||||
| """Format python code according to QMK's style. | ||||
| """ | ||||
| from milc import cli | ||||
| 
 | ||||
| import subprocess | ||||
| 
 | ||||
| 
 | ||||
| @cli.entrypoint("Format python code according to QMK's style.") | ||||
| def main(cli): | ||||
|     """Format python code according to QMK's style. | ||||
|     """ | ||||
|     try: | ||||
|         subprocess.run(['yapf', '-vv', '-ri', 'bin/qmk', 'lib/python'], check=True) | ||||
|         cli.log.info('Successfully formatted the python code in `bin/qmk` and `lib/python`.') | ||||
|     except subprocess.CalledProcessError: | ||||
|         cli.log.error('Error formatting python code!') | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 skullY
						skullY