Skip to content
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

Allow name of API to be set from CLI #8

Closed
martimatix opened this issue Dec 29, 2017 · 5 comments
Closed

Allow name of API to be set from CLI #8

martimatix opened this issue Dec 29, 2017 · 5 comments

Comments

@martimatix
Copy link
Contributor

This is a feature request for allowing users of graphqelm CLI to set the name of the API with an optional flag.

For example: $ graphqelm https://graphqelm.herokuapp.com/api --name swapi

This would apply the --name argument to:

  1. The top directory of the folder structure. In the example above, the top level folder would become Swapi as opposed to Api.
  2. Each module generated by graphqelm. The module declaration would be appropriately namespaced. e.g. module Swapi.Enum.Episode exposing (..)
@dillonkearns
Copy link
Owner

Hey Mario, good news! I built that feature in a couple of days ago :-) It's in the latest npm package. You could just run graphqelm https://graphqelm.herokuapp.com --base Swapi (here's the line in the usage output). Currently it assumes that you make it capitalized so it's a proper elm module/folder name, and there's no check for that, so that could be improved. And there should probably be an example in the README.

@dillonkearns
Copy link
Owner

I'll leave this open to track that. I'm open to any other feedback as well!

@martimatix
Copy link
Contributor Author

That's good news! It's been a couple of days since I updated graphqelm.

Documentation of the feature in the readme would be nice so that future users can discover it.

Correcting the capitalisation would be a nice to have.

@dillonkearns
Copy link
Owner

I improved the usage instructions in the README and included the --base flag in the example there. Still need to make the --base flag less error-prone.

@dillonkearns
Copy link
Owner

Alright, I published a fix for this! I went with the simplest possible approach: check that the format is good as is with a regex check. I think that should be a pretty good UX, no mystery about certain rules for transforming it for the user to think about or to potentially introduce bugs.

dillonkearns/graphqelm@2daa4ce

Closing this out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants