Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@paulvollmer
Copy link
Contributor

hello,

i added a command to the entc cli to remove the generated files from the given directory. for the clean command the path it is not the ent/schema directory (as it is for entc generate because it will also delete the client.go, config.go etc. files.

the command will read the schema directory and create a list of files that need to be removed based on the files found at the directory.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 13, 2020
@a8m
Copy link
Member

a8m commented Mar 13, 2020

Hey @paulvollmer, and thanks for your contribution!
You know, that's crazy - I have a similar command (entc clean) in my git stash!

Super happy to see this contribution, and I'm going to review this tomorrow. Thanks!

@paulvollmer
Copy link
Contributor Author

paulvollmer commented Mar 13, 2020

@a8m good to hear that the PR is welcome.

at the moment the linter throw an error becasue the main func has more than 100 loc.

it looks like i need to move one more command Run func out of it.

or any other ideas?

i moved the describe Run command to it's own func to let the linter pass.

@a8m
Copy link
Member

a8m commented Mar 30, 2020

Hey @paulvollmer, any update with this PR?

@paulvollmer
Copy link
Contributor Author

paulvollmer commented Apr 20, 2020

Hi @a8m, i hadn't time the last weeks to work on the feature but now i implemented the fileWalk.

i do the following:

walk over the input path and delete all .go files with the header // Code generated by entc, DO NOT EDIT.

after that walk i do a second walk to delete the empty directories (mutate, predicate etc.).

@paulvollmer
Copy link
Contributor Author

paulvollmer commented Sep 28, 2020

@a8m after a long break at this pr i solved the merge conflict.
at the moment the linter fail becasue the main func has too many loc.

what do you think about refactoring the cobra.Command Run func's out of the main?
an other option could be to move all the &cobra.Command{s to separated func's.

I prefer the second option because it is much more cleaner.
here you can find a refactored version: https://github.com/paulvollmer/ent/blob/refactor/cli-commands/cmd/entc/entc.go#L31-L34

@paulvollmer
Copy link
Contributor Author

@luantranminh @a8m i have solved the merge conflicts and the PR is now ready to get merged.

@frederikhors
Copy link
Contributor

What is blocking this merge?

@a8m
Copy link
Member

a8m commented Jun 5, 2022

Thanks for this contribution @paulvollmer, it's really appreciated. I decided to have this logic enabled by default instead of adding a new command to ent. See #2612

@a8m a8m closed this Jun 5, 2022
@frederikhors
Copy link
Contributor

You make my dreams come true, @a8m. 😄

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

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants