cdk8s-team / cdk8s

Define Kubernetes native apps and abstractions using object-oriented programming
https://cdk8s.io
Apache License 2.0
4.36k stars 294 forks source link

[Suggestion] allow to skip the empty directory check when initializing #93

Closed brennerm closed 4 years ago

brennerm commented 4 years ago

Is your feature request related to a problem? Please describe. On several occasions when executing cdk8s init I encountered the following error message: Cannot initialize a project in a non-empty directory. This is completely fine in most cases but e.g. when there's nothing else than a .git folder or anything cdk8s unrelated in the directory it would be very nice to skip this check.

Describe the solution you'd like My proposal would be to add a generic --force or a more specific --skip-empty-check flag to the init command to allow skipping the is-directory-empty-check.

Describe alternatives you've considered Right now I move all files out of the directory, execute cdk8s init and move the files back.

brennerm commented 4 years ago

Hey @eladb, does the project team consider agreeing on this suggestion? If so please let me know whether my proposal sounds good. I'd like to work on this topic and prepare a PR.

eladb commented 4 years ago

Yes, I don’t have any objections. I think this needs to be implemented in sscaffs though

brennerm commented 4 years ago

Ahh I see.

Just found out that aws-cdk had the same issue https://github.com/aws/aws-cdk/issues/1758. Their solution was to ignore hidden files which would be fine for me as well. IMO it makes sense to make both tools behave similar in this regard.

eladb commented 4 years ago

Agreed. Ignoring hidden files is a nice way to deal with it