1212from rich .progress import Progress , SpinnerColumn , TextColumn
1313from rich .text import Text
1414
15+ import upgrade_dependencies .utils as utils
1516from upgrade_dependencies .dependency import GitHubDependency , PyPIDependency
1617from upgrade_dependencies .project import Project
17- from upgrade_dependencies .utils import get_git_status , run_shell_command
1818
1919if TYPE_CHECKING :
2020 from upgrade_dependencies .dependency import Dependency
@@ -339,11 +339,11 @@ def update(
339339 else :
340340 branch_name = f"dependency/{ dep .short_name } -{ version } "
341341
342- run_shell_command (["git" , "checkout" , "-b" , branch_name ])
342+ utils . run_shell_command (["git" , "checkout" , "-b" , branch_name ])
343343
344344 # get status of files before changes
345345 progress .update (task , description = "Updating dependency..." )
346- files_before = get_git_status ()
346+ files_before = utils . get_git_status ()
347347
348348 # warning if there are changed files
349349 if len (files_before ) > 0 :
@@ -356,16 +356,16 @@ def update(
356356 project .update_dependency (dependency = dep , version = version )
357357
358358 # run uv.lock, don't worry if it doesn't work (i.e. uv not installed)
359- run_shell_command (["uv" , "lock" ], suppress_errors = True )
359+ utils . run_shell_command (["uv" , "lock" ], suppress_errors = True )
360360
361361 # get status of files after changes
362- files_after = get_git_status ()
362+ files_after = utils . get_git_status ()
363363
364364 # get only the files that were changed
365365 changed_files = [f for f in files_after if f not in files_before ]
366366
367367 # git add the changed files
368- run_shell_command (["git" , "add" , * changed_files ])
368+ utils . run_shell_command (["git" , "add" , * changed_files ])
369369
370370 # commit the changes
371371 progress .update (task , description = "Committing changes..." )
@@ -378,11 +378,11 @@ def update(
378378 else :
379379 commit_message = f"Bump { dep .package_name } from { old_ver } to { version } "
380380
381- run_shell_command (["git" , "commit" , "-m" , commit_message ])
381+ utils . run_shell_command (["git" , "commit" , "-m" , commit_message ])
382382
383383 # push the branch to GitHub
384384 progress .update (task , description = "Pushing changes to GitHub..." )
385- run_shell_command (["git" , "push" , "origin" , branch_name ])
385+ utils . run_shell_command (["git" , "push" , "origin" , branch_name ])
386386
387387 # create pr_body
388388 progress .update (task , description = "Creating pull request..." )
@@ -400,7 +400,7 @@ def update(
400400 pr_body = ""
401401
402402 # create pull request
403- pr = run_shell_command (
403+ pr = utils . run_shell_command (
404404 [
405405 "gh" ,
406406 "pr" ,
@@ -419,13 +419,19 @@ def update(
419419 )
420420
421421 # re-checkout master branch
422- run_shell_command (["git" , "checkout" , target_branch ])
422+ utils . run_shell_command (["git" , "checkout" , target_branch ])
423423
424424 msg = f"✅ [bold]{ dep .package_name } [/bold] updated! View the pull request at"
425425 msg += f" { pr .stdout } "
426426 rprint (msg )
427427
428428
429+ @app .command ()
430+ def format_yml ():
431+ """Formats the workflow and pre-commit config yaml files."""
432+ utils .format_all_yml_files ()
433+
434+
429435def main ():
430436 """_summary_."""
431437 app ()
0 commit comments