Skip to content

Commit df9316a

Browse files
committed
also check for file
1 parent 9c456cc commit df9316a

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

codeflash/cli_cmds/cli.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ def project_root_from_module_root(module_root: Path, pyproject_file_path: Path)
249249

250250

251251
def handle_optimize_all_arg_parsing(args: Namespace) -> Namespace:
252-
if hasattr(args, "all"):
252+
if hasattr(args, "all") or args.file:
253253
import git
254254

255255
from codeflash.code_utils.git_utils import check_and_push_branch, get_repo_owner_and_name
@@ -259,9 +259,10 @@ def handle_optimize_all_arg_parsing(args: Namespace) -> Namespace:
259259
try:
260260
git_repo = git.Repo(search_parent_directories=True)
261261
except git.exc.InvalidGitRepositoryError:
262+
mode = "--all" if hasattr(args, "all") else "--file"
262263
logger.exception(
263-
"I couldn't find a git repository in the current directory. "
264-
"I need a git repository to run --all and open PRs for optimizations. Exiting..."
264+
f"I couldn't find a git repository in the current directory. "
265+
f"I need a git repository to run {mode} and open PRs for optimizations. Exiting..."
265266
)
266267
apologize_and_exit()
267268
if not args.no_pr and not check_and_push_branch(git_repo, git_remote=args.git_remote):

0 commit comments

Comments
 (0)