This repository was archived by the owner on Sep 25, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Support for helpUrl and improved help text and usage.md #72
Open
andrewdeandrade
wants to merge
5
commits into
master
Choose a base branch
from
helpurl
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
cba765c
Support for helpUrl and improved help text and usage.md
andrewdeandrade a56645e
Document helpUrl in usage.md
andrewdeandrade a446db1
Cleanup
andrewdeandrade d474aa7
Updated manpage
andrewdeandrade 63d4e27
Updated usage.md and manpage
andrewdeandrade File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,90 +11,36 @@ | |
A command line utility to talk to a tchannel server. | ||
|
||
``` | ||
tcurl [-H <hostlist> | -p host:port] <service> <endpoint> [options] | ||
|
||
Version: 4.14.0 | ||
|
||
Options: | ||
--head (-2) [data] JSON or raw | ||
--body (-3) [data] JSON or raw | ||
(JSON promoted to Thrift via IDL when applicable) | ||
--shardKey send ringpop shardKey transport header | ||
--depth=n configure inspect printing depth | ||
--thrift (-t) [dir] directory containing Thrift files | ||
--no-strict parse Thrift loosely | ||
--json (-j) Use JSON argument scheme | ||
(default unless endpoint has ::) | ||
--http method | ||
--raw encode arg2 & arg3 raw | ||
--health | ||
--timeout [num] | ||
usage: tcurl [OPTIONS] service endpoint | ||
|
||
Options: | ||
-h --help Show detailed manpage | ||
-v --version Print version | ||
-H --hostlist Path to hostlist file | ||
-p --peer IP and port of single peer | ||
-t --thrift Path to thrift IDL file | ||
-2 --head <value> Set header to <value> | ||
-3 --body <value> Set body to <value> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that should be JSON for as=json and as=thrift |
||
--http <method> Use HTTP <method> instead of TCP | ||
--health Print health for <service> | ||
--raw Send header and body as binary diaray | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/diaray/data/ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing. --json is still needed to override as=thrift when arg1 contains :: |
||
--shardKey Send Ringpop shardKey transport header | ||
--no-strict Parse thrift IDL files loosely | ||
--timeout <value> Set a timeout value in milliseconds | ||
``` | ||
|
||
[Click here for full usage docs.](usage.md) | ||
|
||
## Installation | ||
|
||
`npm install tcurl` | ||
|
||
## Examples | ||
|
||
### Thrift | ||
|
||
For the purposes of these examples, let's assume that you have a TChannel | ||
server listening on `localhost:1234`. The server registers handlers for the | ||
thrift interface saved as `services/chamber.thrift` and defined as: | ||
|
||
```thrift | ||
struct EchoRequest { | ||
1: required string input; | ||
} | ||
|
||
service Chamber { | ||
string echo( | ||
1: required EchoRequest request; | ||
) | ||
} | ||
``` | ||
|
||
You could use TCurl to query this service by running: | ||
|
||
``` | ||
tcurl -p localhost:1234 chamber Chamber::echo -t ./services -3 '{"request": {"input": "foo"}}' | ||
``` | ||
|
||
## `localhost` caveat | ||
|
||
For TChannel and Hyperbahn to work together effectively, most tchannel services need to listen on the | ||
external IP of the host they are running on. | ||
|
||
This means when you use `127.0.0.1` you cannot reach the service with tcurl as it's not listening on | ||
loopback. | ||
|
||
To make supporting external IPs easier we've made `localhost` resolve to the external IP of the machine. | ||
This means if your listening on loopback you have to use `127.0.0.1` and not `localhost` | ||
|
||
## Exit Codes | ||
|
||
- 0: for all successful requests | ||
- 1: timeout | ||
- 2: cancelled | ||
- 3: busy | ||
- 4: declined | ||
- 5: unexpected error | ||
- 6: bad request | ||
- 7: network error | ||
- 8: unhealthy (broken circuit) | ||
- 124: unhealthy / not OK thrift response | ||
- 125: misc tcurl / tchannel internal error | ||
- 126: response not ok error | ||
- 127: fatal protocol error | ||
`npm install tcurl --global` | ||
|
||
## NPM scripts | ||
|
||
- `npm run add-licence` This will add the licence headers. | ||
- `npm run cover` This runs the tests with code coverage | ||
- `npm run lint` This will run the linter on your code | ||
- `npm run man` This will build the manpage. | ||
- `npm test` This will run the tests. | ||
- `npm run trace` This will run your tests in tracing mode. | ||
- `npm run travis` This is run by travis.CI to run your tests | ||
|
@@ -105,6 +51,7 @@ This means if your listening on loopback you have to use `127.0.0.1` and not `lo | |
- Raynos | ||
- ShanniLi | ||
- kriskowal | ||
- malandrew | ||
|
||
## MIT Licenced | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
or directory containing IDL files. Aside: let’s keep in mind we might someday support passing the path to an
idl
directory too.