Coder Social home page Coder Social logo

py_linenoise's Introduction

py_linenoise

A port of linenoise to Python (because sometimes readline doesn't cut it...)

See: http://github.com/antirez/linenoise

Standard Features

  • Single line editing
  • Multiline editing
  • Input from files/pipes
  • Input from unsupported terminals
  • History
  • Completions
  • Hints

Other Features

  • Line buffer initialization: Set an initial buffer string for editing.
  • Hot keys: Set a special hot key for exiting line editing.
  • Loop Functions: Call a function in a loop until an exit key is pressed.

Examples

example1.py

Matches the example code in the C version of the linenoise library.

example2.py

Implements a heirarchical command line interface using cli.py and the linenoise library.

Motiviation

The GNU readline library is a standard package in Python, but sometimes it's hard to use:

  • How do you have a hot key exit the line editing so you can offer context sensitive help?
  • How do you call a polling function during line editing so you can check for other things?

Having a simple, hackable, native Python implementation of line editing makes these things much easier. The linenoise library in C already offers a simple alternative. Porting these functions to Python makes it even easier to use on any system with a POSIX compatible terminal environment.

py_linenoise's People

Contributors

dbohdan avatar deadsy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

sevikkk

py_linenoise's Issues

Please put a license on the code

As it stands, it is not open source for lack of a license, so technically nobody can use it without your explicit permission. I recommend using GitHub's facilities and putting a BSD license on it.

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.