Skip to content
This repository has been archived by the owner on Nov 16, 2022. It is now read-only.

seanfisk/selexec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

selexec

image

selexec provides pipline selection the UNIX way. A simple example illustrates it best.

Let's say you want to edit a few Python files in your project tree, but you're not sure which ones you'd like to edit without seeing them. Normally, you might run the following:

$ find . -name '*.py'
eggs/bedevere.py
eggs/galahad.py
spam/lancelot.py
spam/robin.py
# oh, that's right, I wanted to edit galahad and lancelot
$ $EDITOR eggs/galahad.py spam/lancelot.py

There's a bit of extra typing in the second command, which involves re-typing the names of the files. Why not just select them from the already-produced list? With selexec, you can:

$ find . -name '*.py' | slxc | xargs $EDITOR

The slxc command takes a list on standard input. It will then bring up an interface which allows you to select one, many, or all items in the list. Once the choice is made, the truncated list will be echoed to standard output.

selexec is not limited to files only. Let's say you wanted to uninstall a couple plugins for pytest, but weren't sure of their names. It's pipeline time!

$ pip freeze | grep pytest | slxc | xargs pip uninstall --yes

As you can see, with selexec, you can save a lot of time avoiding retyping items you've already seen.

Enjoy using selexec!

Development

Run

The program can be run locally by following these steps. First install the requirements:

pip install -r requirements/dev.txt

Then run with the current directory on the PYTHONPATH:

PYTHONPATH=$PWD python selexec/console/main.py

Test

Tests are written using pytest and mock. To run unit tests and PEP8 enforcement, run:

shovel test_all

Continuous integration is provided by Travis-CI. Find the build status at https://secure.travis-ci.org/#!/seanfisk/selexec.

Test Coverage

To view the test coverage report, run:

shovel coverage

Emacs Tags File

Sean uses Emacs to edit code. To easily generate a tags file for Emacs, run:

shovel emacs_tags

This command uses Exuberant Ctags to generate a TAGS file. Within Emacs, run M-x visit-tags-table to load the generate tags file. Then use ido-find-file-in-tag-files to find project files.

License

image

selexec is free software licensed under the GNU General Public License version 3.

Credits

selexec makes use of the following libraries/tools/services:

Authors

Note

selexec is inspired by the vipe tool in moreutils that allows a user to insert a text editor into a pipe. It can be used for much the same purpose with somewhat greater hassle:

$ find . -name '*.py' | vipe | xargs $EDITOR

...which would allow me to edit a list of files I'd like to open in my editor before actually opening them.

About

Pipeline list selection the UNIX way

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages