Skip to content

hackathon-2022-ticli/ticli

Repository files navigation

TiCLI

A modern cli for tikv.

CICD GitHub AUR version Platform

Features

  • Support both Raw and Transaction KV API.
  • Support both REPL and Command mode.
  • Support for parsing and executing command scripts.
  • Correctly handling CJK and emoji characters.
  • Pretty and configurable output styles.
  • Auto completion and syntax highlight.
  • Auto switch the output style according to whether stdout is a tty.

Installation

On macOS

You can install ticli with Homebrew:

brew tap hackathon-2022-ticli/homebrew-ticli
brew install ticli

On Arch Linux

ticli is available in the Arch User Repository. To install it from AUR:

paru -S ticli # or yay -S ticli

From binaries

Pre-built versions of ticli for various architectures are available at Github release page.

From source

If you have latest Rust toolchains installed you can use cargo to install it from source:

cargo install --git https://github.com/hackathon-2022-ticli/ticli

Supported commands

Command Description
GET Get the value of key
GETB Get the value of key in binary format
SET Set key to hold the string value
SETB Set key to hold the binary data from the file or pipe
INCR Increments the number stored at key by one
INCRBY Increments the number stored at key by increment
DECR Decrements the number stored at key by one
DECRBY Decrements the number stored at key by decrement
DELETE Delete the specified key
STRLEN Get the length of the bytes stored at key
EXISTS Returns if key exists
SCAN Scan keys between the range
COUNT Count keys between the range
SOURCE Execute commands from file
LOADCSV Load kv records from csv file
FLUSHALL Remove all keys from tikv
PING Return pong when connection is alive
STYLE Specify the output table style
QUIT Exit the program
HELP Print this message or the help of the given subcommand(s)

Run ticli --help to view detailed usage.

Keybindings

Emacs-style keybindings are available in REPL mode:

Keystroke Action
Ctrl-A, Home Move cursor to the beginning of line
Ctrl-B, Left Move cursor one character left
Ctrl-C Interrupt/Cancel edition
Ctrl-D (if line is empty) End of File
Ctrl-D, Del (if line is not empty) Delete character under cursor
Ctrl-E, End Move cursor to end of line
Ctrl-F, Right Move cursor one character right
Ctrl-H, Backspace Delete character before cursor
Ctrl-I, Tab Next completion
Ctrl-J, Ctrl-M, Enter Finish the line entry
Ctrl-K Delete from cursor to end of line
Ctrl-L Clear screen
Ctrl-N, Down Next match from history
Ctrl-P, Up Previous match from history
Ctrl-R Reverse Search history (Ctrl-S forward, Ctrl-G cancel)
Ctrl-T Transpose previous character with current character
Ctrl-U Delete from start of line to cursor
Ctrl-W Delete word leading up to cursor (using white space as a word boundary)
Ctrl-X, Ctrl-U Undo
Ctrl-Z Suspend (Unix only)
Meta-< Move to first entry in history
Meta-> Move to last entry in history
Meta-B, Alt-Left Move cursor to previous word
Meta-D Delete forwards one word
Meta-F, Alt-Right Move cursor to next word
Meta-T Transpose words
Meta-Backspace Kill from the start of the current word

Credits

  • tcil: A tikv cli written in go.

License

ticli is distributed under the terms of both the MIT License and the Apache License 2.0.

See the LICENSE-APACHE and LICENSE-MIT files for license details.