Skip to content

Resolve the default CLI env path on each invocation - #718

Open
kokotatan wants to merge 2 commits into
theskumar:mainfrom
kokotatan:fix-cli-current-directory-default
Open

kokotatan wants to merge 2 commits into
theskumar:mainfrom
kokotatan:fix-cli-current-directory-default

Conversation

@kokotatan

Copy link
Copy Markdown

The CLI evaluates its default .env path when dotenv.cli is imported. If the same command object is then invoked after changing directories, get and list still open the old directory's file, despite the --file help promising the current working directory.

Pass enumerate_env as a callable Click default so it is resolved for each invocation. The regression cases invoke both commands in two directories and check that an explicit --file still takes precedence. Both cases fail before the change and pass afterward.

Validation on Python 3.13 / Windows: 238 passed, 52 skipped; Ruff lint and formatting pass; mypy passes for Python 3.10 through 3.14 with Linux platform checking. The Linux platform flag avoids an existing Windows-only typing error for os.mkfifo in the FIFO tests.

Prepared with OpenAI Codex assistance.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant