Skip to content

Commit

Permalink
Added a way to pass attributes in the CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
paulbjensen committed Aug 5, 2020
1 parent faa5cea commit 2f508ba
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions bin/mcg
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ const mainAction = async ({ args }) => {
const mainDir =
program.mainDir || configFileOptions.mainDir || process.cwd();
const filesCreated = await main(modelName, mainDir, testFolder);
const attributes = program.attributes;
// TODO - have a way to turn the attributes into a JS object
// TODO - use that js object to:
// - create the table columns in the migration file
// - define the properties in the model file's JSON schema
// - define the properties for the test seed data file
// - define the things to test in the model test file (validations)
console.log({attributes});
console.log('Created files:');
filesCreated.forEach((fc) => {
console.log(fc);
Expand All @@ -44,6 +52,10 @@ program
'-m,--mainDir <mainDir>',
'the main folder for the files to be generated in'
)
.option(
'-a, --attributes <attributes...>',
'the attributes to insert into the model'
)
.action(mainAction);

// Run the command
Expand Down

0 comments on commit 2f508ba

Please sign in to comment.