|
1 | | -# Hoppscotch CLI [](https://hoppscotch.io) [](https://goreportcard.com/report/github.com/athul/pwcli) |
| 1 | +# Hoppscotch CLI [](https://hoppscotch.io) [](https://goreportcard.com/report/github.com/athul/pwcli) |
2 | 2 |
|
3 | | -Send HTTP requests from terminal. An alternative to cURL, httpie ⚡️ |
| 3 | +Send HTTP requests from terminal and Generate API Docs. An alternative to cURL, httpie ⚡️ |
4 | 4 |
|
5 | | -# Installation |
| 5 | +## Installation |
6 | 6 |
|
7 | 7 | ### From Script |
8 | 8 |
|
@@ -34,46 +34,80 @@ $ sudo make install |
34 | 34 | - Mac(x64) |
35 | 35 | - Windows(x64,x86) |
36 | 36 |
|
| 37 | +> **IMPORTANT: Not tested on Windows, please leave your feedback/bugs in the Issues section** |
| 38 | +
|
37 | 39 | ### Homebrew |
38 | 40 |
|
39 | 41 | Install by `brew install athul/tap/hopp-cli` |
40 | 42 |
|
41 | | -> **IMPORTANT: Not tested on Windows, please leave your feedback/bugs in the Issues section** |
42 | | -
|
43 | | -# Usages |
| 43 | +## Usages |
44 | 44 |
|
45 | 45 | Putting Simply: **Just pass the URL to the request method** |
46 | | -## Basic |
47 | | -- GET : `hopp-cli get <url> ` |
48 | | -- POST: `hopp-cli post <url> ` |
49 | | -- PATCH: `hopp-cli patch <url>` |
50 | | -- PUT : `hopp-cli put <url>` |
51 | | -- DELETE: `hopp-cli delete <url>` |
52 | 46 |
|
53 | | -Example for a POST request: |
54 | | -`hopp-cli post https://reqres.in/api/users/2 -c js -b '{"name": "morp","job": "zion resident"}` |
| 47 | +### Basic Commands |
| 48 | + |
| 49 | +- GET : `$ hopp-cli get <url> ` |
| 50 | +- POST: `$ hopp-cli post <url> ` |
| 51 | +- PATCH: `$ hopp-cli patch <url>` |
| 52 | +- PUT : `$ hopp-cli put <url>` |
| 53 | +- DELETE: `$ hopp-cli delete <url>` |
| 54 | + |
| 55 | +Example for a POST request: |
| 56 | + |
| 57 | +```shell |
| 58 | +$ hopp-cli post https://reqres.in/api/users/2 -c js -b '{"name": "morp","job": "zion resident"}' |
| 59 | + |
| 60 | +``` |
| 61 | + |
| 62 | +### Extra Commands |
| 63 | + |
| 64 | +- `send` for testing multiple endpoints |
| 65 | +- `gen` for generating API docs from Collection |
| 66 | + |
| 67 | +**SEND**: This can be used to test multiple endpoints from the `hoppscotch-collection.json` file. |
55 | 68 |
|
56 | | -### Extra |
| 69 | +> The output will only be the `statuscode` |
57 | 70 |
|
58 | | -**SEND**: This can be used to test multiple endpoints from the `hoppscotch-collection.json` file. The output will only be the `statuscode`. |
59 | 71 | Example : `hopp-cli send <PATH to hoppscotch collection.json>` |
60 | | -o/p: |
| 72 | + |
| 73 | +Sample Output: |
61 | 74 |  |
62 | 75 |
|
| 76 | +--- |
| 77 | + |
| 78 | +**GEN**: Gen command Generates the API Documentation from `hoppscotch-collection.json` file and serves it as a Static Page on port `1341` |
| 79 | +Example: `hopp-cli gen <PATH to hoppscotch collection.json>` |
| 80 | + |
| 81 | +Sample Hosted site: https://hopp-docsify.surge.sh/ |
| 82 | + |
| 83 | +Powered by [Doscify](https://docsify.js.org) |
| 84 | + |
| 85 | +Flags: |
| 86 | + |
| 87 | +- `browser` or `b` to toggle whether the browser should open automatically [Boolean] |
| 88 | +- `port` or `p` for specifying the port where the server should listen to [Integer] |
63 | 89 |
|
64 | 90 | ### There are 3 Authentication Flags |
65 | | -*(optional)* |
| 91 | + |
| 92 | +_(optional)_ |
| 93 | + |
66 | 94 | - `-t` or `--token` for a Bearer Token for Authentication |
67 | 95 | - `-u` for the `Username` in Basic Auth |
68 | 96 | - `-p` for the `password` in Basic Auth |
| 97 | + |
69 | 98 | ### There are 2 flags especially for the data management requests like POST,PUT,PATCH and DELETE |
70 | | -- `-c` or `--ctype` for the *Content Type* |
71 | 99 |
|
72 | | -- `-b` or `--body` for the Data Body, this can be of json, html or plain text based on the request. |
73 | | - > Enclose the body in Single Quotes(\') |
| 100 | +- `-c` or `--ctype` for the _Content Type_ |
| 101 | + |
| 102 | +- `-b` or `--body` for the Data Body, this can be of json, html or plain text based on the request. |
| 103 | + |
| 104 | +> Enclose the body in Single Quotes(\') |
| 105 | +
|
| 106 | +**Content Types can be of** |
74 | 107 |
|
75 | | -**Content Types can be of** |
76 | | -`html` : `text/html` |
77 | | -`js` : `application/json` |
78 | | -`xml` : `application/xml` |
79 | | -`plain` : `text/plain` |
| 108 | +|Short Code|Content Type| |
| 109 | +|:---:|:---:| |
| 110 | +|`js`|`application/json`| |
| 111 | +|`html`|`text/html`| |
| 112 | +|`xml`|`application/xml`| |
| 113 | +|`plain`|`text/plain`| |
0 commit comments