-
Notifications
You must be signed in to change notification settings - Fork 228
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
pass extra options to httpsnippet (pass through to the target) #222
Conversation
@@ -17,12 +17,23 @@ cmd | |||
.option('-t, --target <target>', 'target output') | |||
.option('-c, --client [client]', 'target client library') | |||
.option('-o, --output <directory>', 'write output to directory') | |||
.option('-x, --extra [{"optionKey": "optionValue"}]', 'provide extra options for the target/client') |
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.
Thoughts on having this so that any argument not strictly defined on the CLI would be interpreted as an option for the targets and be automatically bundled up into extraOptions
? Like:
httpsnippet example.json --target http --output ./snippets --autoHost false --autoContentLength false
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.
Yeah, I had a thought about it too. But it'll take a lot more effort to handle it and parse correctly. Is there only true/false, or other options are available like strings or maybe even arrays? We'll need to parse each option and convert to to the correct type. Is it worth it?
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.
@erunion what does your '+1' mean? is it "ok, really no need to spend time on parsing, passing JSON config is ok", or "yeah you better work on passing options in --autoHost false --autoContentLength false
format"?
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.
It's "that makes sense, leaving it as it is and passing JSON is sounds good to me!"
Hi! I could not find an option to provide extra options to the target. For example if I don't need Host or ContentLength at the http target. Added an option to provide extra options to the target, updated readme
Example:
httpsnippet example.json --target http --output ./snippets -x '{"autoHost": false, "autoContentLength": false}'