Metadata-Version: 2.1
Name: iredis
Version: 1.0.0
Summary: Terminal client for Redis with auto-completion and syntax highlighting.
Home-page: https://github.com/laixintao/iredis
License: BSD-3-Clause
Keywords: Redis,key-value store,Commandline tools,Redis Client
Author: laixintao
Author-email: laixintao1995@163.com
Requires-Python: >=3.6,<4.0
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Environment :: Console
Classifier: Environment :: Console :: Curses
Classifier: Environment :: MacOS X
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Topic :: Database
Requires-Dist: Pygments (>=2,<3)
Requires-Dist: click (>=7.0,<8.0)
Requires-Dist: configobj (>=5.0.6,<6.0.0)
Requires-Dist: mistune (>=0.8.4,<0.9.0)
Requires-Dist: pendulum (>=2.0.5,<3.0.0)
Requires-Dist: prompt_toolkit (>=3,<4)
Requires-Dist: redis (>=3,<4)
Project-URL: Repository, https://github.com/laixintao/iredis
Description-Content-Type: text/markdown

# IRedis (Interactive Redis)

<img align="right" width="100" height="100" src="https://raw.githubusercontent.com/laixintao/iredis/master/docs/assets/logo.png" />

[![CircleCI](https://circleci.com/gh/laixintao/iredis.svg?style=svg)](https://circleci.com/gh/laixintao/iredis)
[![TravisCI](https://travis-ci.org/laixintao/iredis.svg?branch=master)](https://travis-ci.org/laixintao/iredis)
[![PyPI version](https://badge.fury.io/py/iredis.svg)](https://badge.fury.io/py/iredis)
![Python version](https://badgen.net/badge/python/3.6%20|%203.7%20|%203.8/)
[![Chat on telegram](https://badgen.net/badge/icon/join?icon=telegram&label=usergroup)](https://t.me/iredis_users)
[![Open in Cloud Shell](https://badgen.net/badge/run/GoogleCloudShell/blue?icon=terminal)](https://console.cloud.google.com/cloudshell/editor?cloudshell_git_repo=https://github.com/laixintao/iredis&cloudshell_print=docs/cloudshell/run-in-docker.txt)


IRedis is a terminal client for redis with auto-completion and syntax highlighting. IRedis let you type Redis command smoothly, and display the response in a user-friendly format.

IRedis is an alternative for redis-cli. In most cases IRedis behaves exactly the same with redis-cli. Besides, it is safer to use IRedis on production server then redis-cli. IRedis will prevent accidently running dangerous command, like `KEYS *`(See [here](https://redis.io/topics/latency), the *Latency generated by slow commands* section. )

![](./docs/assets/demo.svg)

## Features

- Advanced code completion. If you run command `KEYS` then run `DEL`, iredis will auto complete your command based on `KEYS` result.
- Command validation,(eg. try `CLUSTER MEET IP PORT`, iredis will validate IP and PORT for you)
- Command highlighting, fully based on redis grammar. Any valide command in iredis shell is a valide redis command.
- Human friendly response display.
- `peek` command to check the key's type then automaticly call `get`/`lrange`/`sscan`, etc, depends on types. You don't need to call `type` command then type another command to get value. `peek` will also display the key's length and memory usage.
- <kbd>Ctrl</kbd> + <kbd>C</kbd> to clear cureent line, won't exit redis-cli. Use <kbd>Ctrl</kbd> + <kbd>D</kbd>
- Say "Goodbye!" to you when you exit!
- <kbd>Ctrl</kbd> + <kbd>R</kbd> to open **reverse-i-search** to search through 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.
- Offcial docs build in `HELP` command, try `HELP SET`!
- For full features, please see: [iredis.io/show](https://www.iredis.io/show/)

## Install

Install via pip:

```
pip install iredis
```

Recommended to use [pipx](https://github.com/pipxproject/pipx):

```
pipx install iredis
```

## Usage

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

```
$ iredis --help
```

IRedis support config files. The options from command line will always be the
highest priority. The config files from high priority to low 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.

### Keys

IRedis was compatible with unix-style REPL, which means keys like
<kbd>Ctrl</kbd> + <kbd>F</kbd> to forward works.

Also:

- <kbd>Ctrl</kbd> + <kbd>F</kbd> (i.e. EOF) to exit, you can also use `exit` command.
- <kbd>Ctrl</kbd> + <kbd>L</kbd> to clear screen, you can also use `clear` command.

## Development

### Release Strategy

The IRedis project was build and released by CircleCI, whenever a tag was pushed to master branch, a new release will be built and uploaded to pypi.org, it's very convenient.

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

### Setup Environment

iredis favors [poetry](https://github.com/sdispater/poetry) as a packagement tool. You can setup a develop envioment on your computer easily.

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

```
pip install poetry
```

Then run(which euqals `pip install -e .`):

```
poetry install
```

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

### Development Logs

Since this is a commandline tool, so we didn't write logs to stdout.

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

### CI

We use [pexpect](https://pexpect.readthedocs.io/en/stable/) to test commandline
behavior, since there are problems with circleci's tty, so we run
pexpect-related tests on travis, and run unittest/black style check/flake8 check
on circleci.

For local development, you just run `pytest`, if all tests passed locally, it
shall be passed on CI.

### Command Reference

There is a full Redis command list in [commands.csv](docs/commands.csv) file, downloaded by:

```
python scripts/download_redis_commands.py > data/commands.csv
```

`commands.csv` is here only for test if redis.io was updated, do not package it into release.

Current implemented commands: [command_syntax.csv](iredis/data/command_syntax.csv).

## Planned Features

Please see issue. And you are welcome to submit one.

## Related Projects

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

