No description
Find a file
2018-10-25 15:20:20 +03:00
prompt Upload to Github 2018-10-25 15:20:20 +03:00
LICENSE Upload to Github 2018-10-25 15:20:20 +03:00
prompt.nim Upload to Github 2018-10-25 15:20:20 +03:00
prompt.nimble Upload to Github 2018-10-25 15:20:20 +03:00
README.md Upload to Github 2018-10-25 15:20:20 +03:00

nim-prompt

Software License

A library for building powerful interactive prompts inspired by python-prompt-toolkit, making it easier to build cross-platform command line tools using Nim.

Projects using nim-prompt

  • nim-chronicles. The log filtering tool chronicles_tail was the original project that lead to the creation of this library.

Features

Powerful auto-completion

Keyboard Shortcuts

The provided shortcuts should be familiar to most Windows, macOS and Linux users.

Key Binding Description
Home, Ctrl + A Go to the beginning of the line
End, Ctrl + E Go to the end of the line
Up Arrow, Ctrl + P Previous command, Previous completion
Down Arrow, Ctrl + N Next command, Next completion
Right Arrow, Ctrl + F Forward one character
Left Arrow, Ctrl + B Backward one character
Ctrl + Right Arrow, Alt + F Move to next word
Ctrl + Left Arrow, Alt + B Move to previous word
Delete, Ctrl + D Delete character under the cursor
Backspace, Ctrl + H Delete character before the cursor
Ctrl + Delete Delete to end of word
Ctrl + Backspace Delete to beginning of word
Tab Trigger auto-complete, Select next completion
Ctrl + L Clear the screen
Enter, Ctrl + J Accept line

History

You can use Up arrow and Down arrow to walk through the history of commands executed. An optional history file can be specified for each user program.

Unicode aware

nim-prompt will correctly handle and display all unicode characters. In the public API, all procs use UTF-8 encoded strings on all platforms.

Multiple platform support

We have confirmed nim-prompt works fine in the following terminals:

  • iTerm2, Terminal.app (macOS)
  • Command Prompt (Windows)
  • gnome-terminal (Ubuntu)

License

This software is licensed under the BSD 2-Clause license, see LICENSE for more information.