move loglevel

This commit is contained in:
Elijah 2025-01-21 16:10:23 +00:00
parent d7e16afda2
commit 7f17eb9398
2 changed files with 7 additions and 3 deletions

View File

@ -566,9 +566,8 @@ def rename(
"""Rename the app in the current directory."""
from reflex.utils import prerequisites
console.set_log_level(loglevel)
prerequisites.validate_app_name(new_name)
prerequisites.rename_app(new_name)
prerequisites.rename_app(new_name, loglevel)
cli.add_typer(db_cli, name="db", help="Subcommands for managing the database schema.")

View File

@ -504,6 +504,7 @@ def rename_path_up_tree(full_path: str | Path, old_name: str, new_name: str) ->
new_base = base.replace(old_name, new_name)
new_path = directory / new_base
current_path.rename(new_path)
console.debug(f"Renamed {current_path} -> {new_path}")
current_path = new_path
else:
new_path = current_path
@ -514,15 +515,19 @@ def rename_path_up_tree(full_path: str | Path, old_name: str, new_name: str) ->
return new_path
def rename_app(new_app_name: str):
def rename_app(new_app_name: str, loglevel: constants.LogLevel):
"""Rename the app directory.
Args:
new_app_name: The new name for the app.
loglevel: The log level to use.
Raises:
Exit: If the command is not ran in the root dir or the app module cannot be imported.
"""
# Set the log level.
console.set_log_level(loglevel)
if not constants.Config.FILE.exists():
console.error(
"No rxconfig.py found. Make sure you are in the root directory of your app."