https://github.com/utilyre/climan
A file based HTTP client
https://github.com/utilyre/climan
cli client golang http rest
Last synced: 5 months ago
JSON representation
A file based HTTP client
- Host: GitHub
- URL: https://github.com/utilyre/climan
- Owner: utilyre
- License: mit
- Created: 2022-09-06T11:06:22.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-10-15T14:54:34.000Z (over 3 years ago)
- Last Synced: 2024-12-26T11:07:47.766Z (over 1 year ago)
- Topics: cli, client, golang, http, rest
- Language: Go
- Homepage:
- Size: 85.9 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
CLI Man
Make HTTP requests from command line BLAZINGLY FASTER!
## 📦 Installation
- [Latest Release](https://github.com/utilyre/climan/releases/latest).
- [AUR](https://aur.archlinux.org/packages/climan-bin)
```bash
yay -S climan-bin
```
- Manual
Clone the latest version of climan
```bash
git clone --depth=1 --branch=v0.3.1 https://github.com/utilyre/climan.git
```
Hop into the cloned repo and build
```bash
cd climan
go build
```
## 🌟 Integration
### Neovim
In order to get syntax highlighting with nvim-treesitter plugin run `:TSInstall
http` and add the following to your config
```lua
vim.filetype.add({
extension = {
http = "http",
rest = "http",
},
})
```
## 🚀 Usage
HTTP file example (see [examples](/examples) for more)
```http
# example.http
# [METHOD] [URL]
POST http://localhost:8080
# [Header]: [value]
Content-Type: application/json
User-Agent: Mozilla/5.0 (Windows NT 6.0; en-US; rv:1.9.1.20) Gecko/20140827 Firefox/35.0
# Environment variables in the form of ${VAR} will be replaced with their corresponding value if any
# Prefix $ with a backslash to ignore (e.g. \${VAR})
Authorization: Bearer ${TOKEN}
# Body
{
"title": "climan",
"description": "A file based HTTP client"
}
# The next line is an special type of comment that separates requests
###
GET http://localhost:8080
User-Agent: Mozilla/5.0 (Windows NT 6.0; en-US; rv:1.9.1.20) Gecko/20140827 Firefox/35.0
```
**NOTE**: Trailing comment is _NOT_ available.
---
Make the first (and maybe the only) request of `example.http`
```bash
climan example.http
```
Make the first request of `example.http` and replace `${TOKEN}` with
`INSERT_TOKEN_HERE`
```bash
export TOKEN="INSERT_TOKEN_HERE"
climan -i 1 example.http
```
Make the second request of `example.http`
```bash
climan -i 2 example.http
```
Make the last request of `example.http`
```bash
climan -i -1 example.http
```
Make the second request of `example.http` and output verbosely
```bash
climan -vi 2 example.http
```
Learn more
```bash
climan -h
man climan
```
## 🔖 To-do's
- [x] Support for other request body types (like `text/xml` and `text/plain`).
- [x] Parse the response body base on `Content-Type` header.
- [x] Show response details.
- [x] Colored output.
- [ ] Colored response body.
- [x] Environment variable support.
- [ ] Add more `http` examples.
## 📢 Credits
- [REST Client](https://github.com/Huachao/vscode-restclient)