Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Error: unknown flag: --use-model #751

Closed
kberov opened this issue Nov 12, 2017 · 6 comments
Closed

Error: unknown flag: --use-model #751

kberov opened this issue Nov 12, 2017 · 6 comments
Labels
bug Something isn't working help wanted Feel free to contribute!
Milestone

Comments

@kberov
Copy link
Contributor

kberov commented Nov 12, 2017

Hello,
I already have a generated model like this:

buffalo db g model -s users id:uuid login_name:string login_password:string \
    first_name:string last_name:string email:string description:string \
    created_by:uuid changed_by:uuid start_date:int stop_date:int

Now I want to use it to create the rest of the resource.
buffalo help g r has an example:

$ buffalo g resource users --use-model users
Generates:

- actions/users.go
- actions/users_test.go

I run buffalo g r users --use-model users and I get the help message with the above mentioned error at the bottom.
Buffalo version is: v0.10.1
Regards,

@markbates
Copy link
Member

There’s no flag by that name. If you run buffalo g resource —help it’ll show the available flags. I think what you’re looking for is —skip-model.

@markbates markbates added the bug Something isn't working label Nov 13, 2017
@markbates markbates added this to the 0.10.2 milestone Nov 13, 2017
@markbates
Copy link
Member

This appears to be a regression from v0.9.5

@markbates markbates added the help wanted Feel free to contribute! label Nov 13, 2017
@jmbrunskill
Copy link

@markbates I checked out and build v0.9.5 tag from git.

It looks like the only difference between buffalo g r users and buffalo g r users --use-model users is that if you do not specify --use-model the generator will overwrite your 'users' model.

So if I am to understand the task correctly we need to.
A) Reinstate the --use-model flag
B) When the --use-model flag is passed in, don't over write the specified model file with a generated one

If so, I'm happy to have a go at implementing this.
FYI - I'm pretty new to go (and to github contributions) but keen to learn.

@markbates
Copy link
Member

@jmbrunskill That's basically the gist of it. It basically turns off the call to the soda generator that generates a model and a migration. shouldn't be too hard to implement. Would love to see this happen! :)

@jmbrunskill
Copy link

@markbates Great I've updated the code to handle this.

A quick question before I submit a PR.
It looks like the old --use-model took a string which it used as the model name.
I've replicated this functionality, but was wondering if it would be better to make --use-model a boolean and use the existing --name flag to set the model name?

@jmbrunskill
Copy link

Decided to go ahead an create the PR can continue the discussion there.

markbates added a commit that referenced this issue Nov 29, 2017
Fix Issue #751 - unknown flag: --use-model
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working help wanted Feel free to contribute!
Projects
None yet
Development

No branches or pull requests

3 participants