File: README.md

package info (click to toggle)
iredis 1.9.1-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,388 kB
  • sloc: python: 6,494; sh: 16; makefile: 13
file content (228 lines) | stat: -rw-r--r-- 8,642 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
<p align="center">
  <img width="100" height="100" src="https://raw.githubusercontent.com/laixintao/iredis/master/docs/assets/logo.png" />
</p>

<h3 align="center">Interactive Redis: A Cli for Redis with AutoCompletion and Syntax Highlighting.</h4>

<p align="center">
<a href="https://github.com/laixintao/iredis/actions"><img src="https://github.com/laixintao/iredis/workflows/Test/badge.svg" alt="Github Action"></a>
<a href="https://badge.fury.io/py/iredis"><img src="https://badge.fury.io/py/iredis.svg" alt="PyPI version"></a>
<img src="https://badgen.net/badge/python/3.6%20|%203.7%20|%203.8/" alt="Python version">
<a href="https://pepy.tech/project/iredis"><img src="https://pepy.tech/badge/iredis" alt="Download stats"></a>
<a href="https://t.me/iredis_users"><img src="https://badgen.net/badge/icon/join?icon=telegram&amp;label=usergroup" alt="Chat on telegram"></a>
<a href="https://console.cloud.google.com/cloudshell/editor?cloudshell_git_repo=https://github.com/laixintao/iredis&amp;cloudshell_print=docs/cloudshell/run-in-docker.txt"><img src="https://badgen.net/badge/run/GoogleCloudShell/blue?icon=terminal" alt="Open in Cloud Shell"></a>
</p>

<p align="center">
  <img src="./docs/assets/demo.svg" alt="demo">
</p>

IRedis is a terminal client for redis with auto-completion and syntax
highlighting. IRedis lets you type Redis commands smoothly, and displays results
in a user-friendly format.

IRedis is an alternative for redis-cli. In most cases, IRedis behaves exactly
the same as redis-cli. Besides, it is safer to use IRedis on production servers
than redis-cli: IRedis will prevent accidentally running dangerous commands,
like `KEYS *` (see
[Redis docs / Latency generated by slow commands](https://redis.io/topics/latency#latency-generated-by-slow-commands)).

## Features

- Advanced code completion. If you run command `KEYS` then run `DEL`, IRedis
  will auto-complete your command based on `KEYS` result.
- Command validation. IRedis will validate command while you are typing, and
  highlight errors. E.g. try `CLUSTER MEET IP PORT`, IRedis will validate IP and
  PORT for you.
- Command highlighting, fully based on redis grammar. Any valid command in
  IRedis shell is a valid redis command.
- Human-friendly result display.
- _pipeline_ feature, you can use your favorite shell tools to parse redis'
  response, like `get json | jq .`.
- Support pager for long output.
- Support connection via URL, `iredis --url redis://example.com:6379/1`.
- Store server configuration: `iredis -d prod-redis` (see [dsn](#using-dsn) for
  more).
- `peek` command to check the key's type then automatically call
  `get`/`lrange`/`sscan`, etc, depending on types. You don't need to call the
  `type` command then type another command to get the value. `peek` will also
  display the key's length and memory usage.
- <kbd>Ctrl</kbd> + <kbd>C</kbd> to cancel the current typed command, this won't
  exit IRedis, exactly like bash behaviour. Use <kbd>Ctrl</kbd> + <kbd>D</kbd>
  to send a EOF to exit IRedis.
- <kbd>Ctrl</kbd> + <kbd>R</kbd> to open **reverse-i-search** to search through
  your command history.
- Auto suggestions. (Like [fish shell](http://fishshell.com/).)
- Support `--encode=utf-8`, to decode Redis' bytes responses.
- Command hint on bottom, include command syntax, supported redis version, and
  time complexity.
- Official docs with built-in `HELP` command, try `HELP SET`!
- Written in pure Python, but IRedis was packaged into a single binary with
  [PyOxidizer](https://github.com/indygreg/PyOxidizer), you can use cURL to
  download and run, it just works, even you don't have a Python interpreter.
- Hide password for `AUTH` command.
- Says "Goodbye!" to you when you exit!
- For full features, please see: [iredis.io](https://www.iredis.io)

## Install

Install via pip:

```
pip install iredis
```

[pipx](https://github.com/pipxproject/pipx) is recommended:

```
pipx install iredis
```

Or you can download the executable binary with cURL(or wget), untar, then run.
It is especially useful when you don't have a python interpreter(E.g. the
[official Redis docker image](https://hub.docker.com/_/redis/) which doesn't
have Python installed.):

```
wget  https://github.com/laixintao/iredis/releases/latest/download/iredis.tar.gz \
 && tar -xzf iredis.tar.gz \
 && ./iredis
```

(Check the [release page](https://github.com/laixintao/iredis/releases) if you
want to download an old version of IRedis.)

## Usage

Once you install IRedis, you will know how to use it. Just remember, IRedis
supports similar options like redis-cli, like `-h` for redis-server's host and
`-p` for port.

```
$ iredis --help
```

### Using DSN

IRedis support storing server configuration in config file. Here is a DSN
config:

```
[alias_dsn]
dev=redis://localhost:6379/4
staging=redis://username:password@staging-redis.example.com:6379/1
```

Put this in your `iredisrc` then connect via `iredis -d staging` or
`iredis -d dev`.

### Configuration

IRedis supports config files. Command-line options will always take precedence
over config. Configuration resolution from highest to lowest precedence is:

- _Options from command line_
- `$PWD/.iredisrc`
- `~/.iredisrc` (this path can be changed with `iredis --iredisrc $YOUR_PATH`)
- `/etc/iredisrc`
- default config in IRedis package.

You can copy the _self-explained_ default config here:

https://raw.githubusercontent.com/laixintao/iredis/master/iredis/data/iredisrc

And then make your own changes.

(If you are using an old versions of IRedis, please use the config file below,
and change the version in URL):

https://raw.githubusercontent.com/laixintao/iredis/v1.0.4/iredis/data/iredisrc

### Keys

IRedis support unix/readline-style REPL keyboard shortcuts, which means keys
like <kbd>Ctrl</kbd> + <kbd>F</kbd> to forward work.

Also:

- <kbd>Ctrl</kbd> + <kbd>F</kbd> (i.e. EOF) to exit; you can also use the `exit`
  command.
- <kbd>Ctrl</kbd> + <kbd>L</kbd> to clear screen; you can also use the `clear`
  command.
- <kbd>Ctrl</kbd> + <kbd>X</kbd> <kbd>Ctrl</kbd> + <kbd>E</kbd> to open an
  editor to edit command, or <kbd>V</kbd> in vi-mode.

## Development

### Release Strategy

IRedis is built and released by CircleCI. Whenever a tag is pushed to the
`master` branch, a new release is built and uploaded to pypi.org, it's very
convenient.

Thus, we release as often as possible, so that users can always enjoy the new
features and bugfixes quickly. Any bugfix or new feature will get at least a
patch release, whereas big features will get a minor release.

### Setup Environment

IRedis favors [poetry](https://github.com/sdispater/poetry) as package
management tool. To setup a develop environment on your computer:

First, install poetry (you can do it in a python's virtualenv):

```
pip install poetry
```

Then run (which is similar to `pip install -e .`):

```
poetry install
```

**Be careful running testcases locally, it may flush you db!!!**

### Development Logs

This is a command-line tool, so we don't write logs to stdout.

You can `tail -f ~/.iredis.log` to see logs, the log is pretty clear, you can
see what actually happens from log files.

### Catch Up with Latest Redis-doc

IRedis use a git submodule to track current-up-to-date redis-doc version. To
catch up with latest:

1. Git pull in redis-doc
2. Copy doc files to `/data`: `cp -r redis-doc/commands* iredis/data`
3. Prettier
   markdown`prettier --prose-wrap always iredis/data/commands/*.md --write`
4. Check the diff, update IRedis' code if needed.

## Related Projects

- [redis-tui](https://github.com/mylxsw/redis-tui)

If you like iredis, you may also like other cli tools by
[dbcli](https://www.dbcli.com/):

- [pgcli](https://www.pgcli.com) - Postgres Client with Auto-completion and
  Syntax Highlighting
- [mycli](https://www.mycli.net) - MySQL/MariaDB/Percona Client with
  Auto-completion and Syntax Highlighting
- [litecli](https://litecli.com) - SQLite Client with Auto-completion and Syntax
  Highlighting
- [mssql-cli](https://github.com/dbcli/mssql-cli) - Microsoft SQL Server Client
  with Auto-completion and Syntax Highlighting
- [athenacli](https://github.com/dbcli/athenacli) - AWS Athena Client with
  Auto-completion and Syntax Highlighting
- [vcli](https://github.com/dbcli/vcli) - VerticaDB client
- [iredis](https://github.com/laixintao/iredis/) - Client for Redis with
  AutoCompletion and Syntax Highlighting

IRedis is build on the top of
[prompt_toolkit](https://github.com/jonathanslenders/python-prompt-toolkit), a
Python library (by [Jonathan Slenders](https://twitter.com/jonathan_s)) for
building rich commandline applications.