-
Notifications
You must be signed in to change notification settings - Fork 326
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
load HTTP Prompt environment from command line #131
Comments
I did a bit of research already and the option 2 might turn to be more tricky. The prompt-toolkit doesn't support piping (see prompt-toolkit/python-prompt-toolkit#502) and will actually "crash" in such a case We could surely use the snippet mentioned in that previous issue
and load the context from this data but the prompt still exits (from https://github.com/jonathanslenders/python-prompt-toolkit/blob/master/prompt_toolkit/input.py#L67), unless we overwrite Probably the other option would be not to use the So if you're ok with the option 1 of the |
I tried it before, piping data to from stdin to a prompt-toolkit app is indeed not an easy thing to do. So I think we can add a |
It would be convenient to be able to load a HTTP Prompt environment from the command line so as to launch http-prompt with a predefined context without requiring any manual input within http-prompt. Currently the only way to fully load such an environment is to execute
exec /path/to/project.hp
interactively.Loading an environment in such a way would allow the creation of aliases
I'm thinking of 2 different ways to do this:
add a
--env
cli parameter to would take the environment file to load as parameterhttp-prompt --env /path/to/project.hp
support receiving data from stdin
cat /path/to/project.hp | http-prompt
Each of these option would make it possible to create aliases:
alias http_project_prod='http-prompt --env /path/to/project_prod.hp
alias http_project_test='http-prompt --env /path/to/project_test.hp
alias http_project_prod='cat /path/to/project_prod.hp | http-prompt'
alias http_project_test='cat /path/to/project_test.hp | http-prompt'
Please let me know what you think of it
I'm willing to implement it myself if
The text was updated successfully, but these errors were encountered: