-
Notifications
You must be signed in to change notification settings - Fork 52
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 a CLI option to change output filenames #141
Conversation
…erate filenames with underscores for better readability and consistency with some coding standards
…ting of models with underscores in their names ✨ (testmodels): Add new CompositePrimaryKey model for testing composite primary keys 📝 (testmodels): Add methods for CompositePrimaryKey model to handle CRUD operations and queries ✨ Add new functions to read and find CompositePrimaryKeys by ZYError and XY ♻️ Refactor the way CompositePrimaryKeys are read and found by ZError, now using a new decoder 💡 Update comments to reflect changes in function behavior and usage ✨ (testmodels): Add new FereignItem model for testing underscore handling in model names 📝 (testmodels): Add methods for FereignItem model to handle CRUD operations and column value manipulation ✨ Add new test model 'FullType' in 'full_type.yo.go' for testing various data types ✨ Add new functions to handle FullType operations in the database This commit introduces new functions to handle FullType operations such as Insert, Update, Delete, and Find. These functions are necessary to perform CRUD operations on the FullType table in the database. ✨ Add new functions to retrieve rows from 'FullTypes' by different keys and indexes. This allows more flexible data retrieval based on different criteria. ✨ (generated_column.yo.go): Add new generated model for 'GeneratedColumns' table with CRUD operations and helper functions. This will allow us to interact with the 'GeneratedColumns' table in a type-safe manner. ✨ Add new test models for 'Items' and 'MaxLengths' to improve test coverage and validate functionality for different data types and operations. ✨ (testmodels): Add new test model 'OutOfOrderPrimaryKey' to handle primary keys in non-sequential order 📝 (testmodels): Document the usage and functions of 'OutOfOrderPrimaryKey' model ✨ (testmodels/underscores): Add new test models for handling snake_case naming convention 📝 (snake_case.yo.go): Add new model SnakeCase with CRUD operations and helper functions 📝 (yo_db.yo.go): Add new database interface YODB and YORODB for common database operations 💡 These changes are necessary to test and ensure the correct handling of snake_case naming convention in the application.
…llow underscores in file names
…melToSnake for better maintainability and reliability 🔧 (generator.go): Add dependency on "github.com/kenshaw/snaker" for string conversion functionality
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! I left one comment, but it almost LGTM 👍
cmd/root.go
Outdated
@@ -123,6 +124,7 @@ func setRootOpts(cmd *cobra.Command, opts *internal.ArgType) { | |||
cmd.Flags().StringVarP(&opts.Out, "out", "o", "", "output path or file name") | |||
cmd.Flags().StringVar(&opts.Suffix, "suffix", defaultSuffix, "output file suffix") | |||
cmd.Flags().BoolVar(&opts.SingleFile, "single-file", false, "toggle single file output") | |||
cmd.Flags().BoolVar(&opts.FilenameWithUnderscores, "with-underscores", false, "toggle underscores in file names") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To align with the other options such as the suffix
flag, how about removing with
and naming it underscore
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed 2c06c11
…ltiple files for consistency and clarity 🐛 Fix typo in comment in 'internal/argtype.go' file
…erscore' for consistency and to avoid potential confusion ✨ (testmodels): Add new CompositePrimaryKey model for testing composite primary keys 📝 (testmodels): Add methods for CompositePrimaryKey model to handle CRUD operations and queries ✨ Add new functions to read and find CompositePrimaryKeys by ZYError and XY 💡 These functions allow retrieving multiple rows from 'CompositePrimaryKeys' as a slice of CompositePrimaryKey using different parameters and indices. ✨ (testmodels): Add new FereignItem model in testmodels for testing purposes 📝 (fereign_item.yo.go): Add methods for FereignItem model to interact with database (insert, update, delete, find, read) ✨ Add new FullType model in testmodels for testing various data types and their nullable versions. This will help in ensuring the robustness of the application by testing all possible data types. ✨ Add new functions to handle FullType operations in the database This commit introduces new functions to handle FullType operations such as Insert, Update, Delete, and Find. These functions are necessary to perform CRUD operations on the FullType table in the database. ✨ Add new functions to retrieve rows from 'FullTypes' by different keys and indexes. This allows more flexible data retrieval based on different parameters. ✨ (generated_column.yo.go): Add new generated model for 'GeneratedColumns' table. This includes methods for CRUD operations, and helper functions for handling column values. This change is necessary to interact with the 'GeneratedColumns' table in the database. ✨ Add new test models 'Item' and 'MaxLength' for testing purposes. These models will be used in unit tests to ensure the correct functionality of the application. ✨ (testmodels): Add new test model 'OutOfOrderPrimaryKey' to verify primary key order handling in the application. This model will help in testing the functionality of the application when the primary keys are not in order. ✨ (testmodels/underscore): Add new test models for snake_case handling 📝 (testmodels/underscore): Add documentation for new test models 💡 (testmodels/underscore): Add comments to new test models for better understanding of the code
…igning the properties of the GeneratorOption object.
…score' to match the actual flag name in the code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! LGTM 👍
Add
--underscore
option for generator.If you enable this option, the generated filenames will be word-separated and underscores will be inserted.