Skip to content

Building powerful interactive prompts in Nim, inspired by python-prompt-toolkit.

License

Notifications You must be signed in to change notification settings

Element-0/nim-prompt

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Building powerful interactive prompts in Nim, inspired by python-prompt-toolkit.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Nim 100.0%