Giter VIP home page Giter VIP logo

choose's Introduction

choose - make choices on the command line

reads lines from stdin, lets user choose one line in an urwid (ncurses like) interface, then prints that line to stdout and exits. Input will be aligned to tabs(\t). After reading from stdin, in attaches itself directly to the currently active tty, thus it can work with piped input:

get_data.sh | choose | other_script.sh

Choose should run on all *NIXes, but might not work in non utf-8 locales.

An example of piping the output of pc_query -t searchstring into choose:

choose's People

Contributors

geier avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

choose's Issues

Install instructions

Consider adding install instructions to readme.md. In particular,
sudo pip install urwid
Ez-install system could also work. System should prompt for syntax to install pip, as needed.

Filtering broken?

Am I just "doing it wrong" or is filtering broken on MacOS X? When I try e.g.

echo -e 'apple\npear\ngrape\nbanana' | choose

and then type 'ap' to filter to apple & grape, it correctly filters those.

BUT, if I backspace and change 'ap' to 'an' - instead of showing 'banana' it shows nothing and I have to CTRL+C to quit out.

SyntaxWarning: "is" with a literal. Did you mean "=="?

On macOS with Python 3.11:

$ docker ps | choose -1
/opt/homebrew/Cellar/choose/0.1.0_4/libexec/bin/choose:138: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if len(names) is 1:
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES

Tag a release?

Hello,
Could you please tag a release here so we could use it to have choose in Homebrew core?
Thanks!

tty is assumed when it might be prompted

Hello Christian, thanks for this script : it is comes handy indeed !
I actually can not use "choose" as I would, for when I select a line, it gets printed, but not piped.

I am not a shell guru, but I would say my console uses /dev/pts/1 as tty
not /dev/tty which is hardcoded at the end of your script :
any chance used tty can be detected and used in your script ?

Thanks, Arnaudv6

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.