Closed lorefnon closed 2 years ago
I don't believe yargs is flexible enough for this:
As added here, this PR proposes two usages:
You can also pass headers (eg. for authentication) to your graphql API endpoint if needed:
npx @timkendall/tql-gen http://api.example.com/graphql --headers.Authorization="Bearer 20394823423"
or
npx @timkendall/tql-gen http://api.example.com/graphql --headers="Authorization: Bearer 20394823423"
In either usage patterns, you can pass multiple headers by repeated usage of --headers
The first usage is what yargs can support out of the box. I also wanted to support the second usage because that is how headers are represented in http request. For supporting both (including repeated invocations) I had added that parsing logic.
If you prefer I can only retain the first usage and simplify the parsing logic.
Let's stick with the simpler parsing logic. I like the fancy version but it's likely going to be hard to port over to the Rust implementation of the CLI (unless one of their mature CLI arg libraries supports this format out of the box).
Thanks. Curious about the motivation for the rust rewrite ? Is it intended to improve performance for cases when the graphql schema changes very frequently and the codegen has to be run repeatedly ?
@lorefnon Exactly.
The latest updates on your projects. Learn more about Vercel for Git ↗︎