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

shell commands - lexer rules, pipe to shell cmd redirection, tests #74

Merged
merged 9 commits into from
Sep 20, 2016

Conversation

fogine
Copy link
Contributor

@fogine fogine commented Aug 23, 2016

As title says... lexer rules for shell commands has been fully implemented... I've added some more tests for this as well...

I've a question, though.
Now, it's possible to define a shell command in full single/double-quoted request mutation. For example, you can do this:

httpie post "`echo name`=value"

Is that the expected behavior, @eliangcs ?
If so, I'll add tests for this...
ps: I'm asking because I couldn't think of a reason why the full single/double-quoted request mutation feature was implemented in first place...

@eliangcs
Copy link
Contributor

Thanks, @fogine ! This was something I wanted to do in PR #61.

For your question, yes, it's possible to write a shell command in a full quoted mutation, see the test cases here: https://github.com/eliangcs/http-prompt/blob/e0308a106f02b20e3e62b17de2d1e344d1c4d624/tests/test_execution.py#L647

Full quoted mutation was implemented because it works on httpie. For instance, http post http://httpbin.org/post "my message=hello world".

@fogine fogine changed the title shell commands - lexer rules + tests shell commands - lexer rules, pipe to shell cmd redirection, tests Sep 1, 2016
@fogine
Copy link
Contributor Author

fogine commented Sep 1, 2016

I've added the "pipe to shell command redirection" to this pull request as discussed in #61 PR.
Things which works now:

localhost> httpie get | tee /tmp/test # output of `httpie get` is redirected to shell subprocess cmd: `tee /tmp/test`
localhost> get some==data| tee /tmp/test # supports "action" commands

localhost> httpie | `echo "sed 's/localhost/127.0.0.1/' "` # this will be "transformed" to httpie | sed 's/localhost/127.0.0.1/' .... Also this is the case where I'm not sure if it's implemented in the best possible way

Lexer rules covers all the possible options now.
Tests updated/added...

I think this PR implements all the remaining functionality to the #61 PR now...?

@eliangcs
Copy link
Contributor

eliangcs commented Sep 5, 2016

@fogine Sorry for my late reply. I'll refactor the code first (in branch eliangcs/refactor-source-and-exec) before I can review this PR. It'll take some time. Thank you for your patience in advance :)

@eliangcs eliangcs merged commit f3c0790 into httpie:issue/54-shell-command Sep 20, 2016
@eliangcs
Copy link
Contributor

Overall looks good. Merged. We can keep fixing details after I resolve the conflicts between PR #61 and the master branch. Thanks!

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

Successfully merging this pull request may close these issues.

2 participants