Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add example env file generator #362

Open
wants to merge 26 commits into
base: main
Choose a base branch
from
Open

Conversation

ethsanders
Copy link

Closes #354

@ethsanders
Copy link
Author

What tests would you recommend adding?

fixed issue with windows directories

removed debug echo statements

Removed old try accept that is no longer needed

Should be the end of my after the fact website commits

Add missing trailing newline when adding new value

Sometimes, the source file doesn't have a trailing newline.  If we add a
new binding in such a case, we need to add a newline before the new
binding.

Release version 0.19.2

updated to remove file error with broken file

fixed minor bug

tests and minor changes
@ethsanders
Copy link
Author

Added a test. Would you consider merging this?

@roy-pstr
Copy link

roy-pstr commented Feb 1, 2022

Hi, looks good, waiting for this feature to be merged.

src/dotenv/cli.py Outdated Show resolved Hide resolved
src/dotenv/cli.py Outdated Show resolved Hide resolved
@ethsanders
Copy link
Author

I just implemented the suggestions you mention here @theskumar.

@theskumar
Copy link
Owner

theskumar commented Jun 5, 2022

@ProfessorPiggos Thanks a lot. This looks much better. Can you add some test cases specific to this new feature? It would be great to check for things like lines # are included in the output and also values are removed properly, to ensure there are no future regressions.

You can also clean/remove up any modifications to CHANGELOG.md, setup.cfg and src/dotenv/version.py. We'll update these after merging.

Also, I'm having a second thought about having this as an additional new command or having it as part of #407.

Some of the variations we can go with at this point are:

  1. dotenv generate-sample (This implementation)
  2. dotenv list --format=sample (if we follow the implementation in feat(cli) add --format= option to list command #407)
  3. dotenv export --format=[sample|json|export|shell]. (New alternate implementation of (2))

@bbc2 Any thoughts?

@ethsanders
Copy link
Author

ethsanders commented Jun 6, 2022

Concerningly, tests are failing as the generate_sample command cannot be found when running the tests with the error Error: No such command 'generate_sample'. As such, none of the tests are working. Does anyone have any idea why this might be? I'll look at it more later.

Other than that, test_generate_sample_comment_preservation and test_generate_sample_value_removal have both been added.

By the way, VSCode wasn't letting me squash commits for some reason. Sorry for commit spam on the PR.

@theskumar
Copy link
Owner

@ProfessorPiggos Try generate-sample instead of generate_sample and don't bother about the commit spam :D

@theskumar theskumar changed the title Example env file generator Add example env file generator Jul 23, 2022
@theskumar theskumar requested a review from bbc2 June 12, 2023 06:41
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.

Feature Request: Generating .env.example file from a .env file
3 participants