tarantool / tarantool/tt

repl: history search by a command prefix

Open
#479 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
113
Forks
18
Avg merge
4d 11h
Merged PRs (30d)
23

Description

readline has very useful feature to search by the commands history backward and forward based on a currently written command prefix.

$ cmake<PgUp>
$ cmake . -DCMAKE_BUILD_TYPE=Debug -DENABLE_BACKTRACE=ON -DENABLE_DIST=ON -DENABLE_FEEDBACK_DAEMON=ON -DENABLE_BUNDLED_LIBCURL=OFF -DENABLE_BUNDLED_LIBUNWIND=ON && make -j8

AFAIU, once enabled in /etc/inputrc (or ~/.inputrc), it works with all readline based tools. At least, it works for me for bash, tarantool, python (since Python 3).

AFAIU, it is not enabled by default in readline, but it is in the default /etc/inputrc on Gentoo. Maybe in some other distros.

https://github.com/gentoo/baselayout/blob/3bfcd8238abf92146a7e17b44625ea1e5325230c/etc/inputrc#L39-L41

I move this part of the inputrc config to everywhere I'm working if it is not present by default.

# map "page up" and "page down" to search history based on current cmdline
"\e[5~": history-search-backward
"\e[6~": history-search-forward

My primary use case with tarantool is the following.

tarantool> fib<PgUp><PgUp>
tarantool> fiber = require('fiber')

I want this behavior in tt as well.

I see the following solution variants:

  • Enable this behaviour by default (Gentoo does, so why not?).
  • Support given inputrc directives.
  • Provide another mechanism/config to enable it system-wide and bind on PgUp/PgDn.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no implementation files or tests. Start by locating tt's interactive REPL input and history handling, then determine which configuration approach the project should support. Done means PgUp and PgDn search history backward and forward using the currently typed command prefix.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.