Skip to main content

Get identifiers, names, paths, URLs and words from the previous command output and use them for the next command in xonsh.

Project description

Get identifiers, names, paths, URLs and words from the previous command output and use them for the next command in xonsh.

Save time. Forget about using mouse, touchpad or trackball to get any words from output to the next command. Secure. The xontrib-output-search is not writing any output on the hard disk. Only latest not empty output stored in the memory. It works the same way as xonsh shell and the security level is the same. Universal. Forget about searching autocomplete plugins for every app you use and get the identifiers from the output.

If you like the idea of xontrib-output-search click ⭐ on the repo and stay tuned by watching releases.

Install

xpip install -U xontrib-output-search
echo 'xontrib load output_search' >> ~/.xonshrc
# Reload xonsh

Usage

After xontrib load output_search you have two ways to select tokens from latest not empty output:

  • Press Alt + F hotkeys
  • Type f__ and press Tab key

If you use this key combination for another function and your muscle memory is strong just change the key before loading the xontrib:

$XONTRIB_OUTPUT_SEARCH_KEY='i'
xontrib load output_search

Use cases

Get URL from output

$ echo "Try https://github.com/xxh/xxh"
Try https://github.com/xxh/xxh
$ git clone xx<Alt+F>
$ git clone https://github.com/xxh/xxh

Get key or value from JSON, Python dict and JavaScript object

$ echo '{"Try": "xontrib-output-search"}'
{"Try": "xontrib-output-search"}
$ echo I should try se<Alt+F>
$ echo I should try xontrib-output-search

Get the path from environment

$ env | grep ^PATH=
PATH=/one/two:/three/four
$ ls fo<Alt+F>
$ ls /three/four

Complete the complex prefix

Get the URL from previous output after typing git+:

$ echo "Try https://github.com/tokenizer/xontrib-output-search"
Try https://github.com/tokenizer/xontrib-output-search

$ pip install git+xo<Alt+F>
$ pip install git+https://github.com/tokenizer/xontrib-output-search

Get the port number from previous output while typing the URL:

$ echo "The port number is 4242"
The port number is 4242

$ curl http://127.0.0.1:4<Alt+F>
$ curl http://127.0.0.1:4242

Get arguments from command help

$ lolcat -h
...
$ lolcat --s<Alt+F>
$ lolcat --seed=SEED

Development

The xontrib-output-search is using tokenize-output for tokenizing.

Checking that output_search xontrib has been loaded:

$ xontrib list output_search
output_search  installed  loaded

$ completer list | grep output_search
xontrib_output_search

Known issues

cat file is not captured

Workaround: cat file | head or cat file | grep text.

Alt+F combination may not working in PyCharm terminal

Workaround: f__ + Tab.

The Alt+F in the readline is to move forward

Workaround: set $XONTRIB_OUTPUT_SEARCH_KEY='i' before xontrib load output_search.

Thanks

I was inspired by xontrib-histcpy. Thanks @con-f-use!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xontrib-output-search-0.5.2.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

xontrib_output_search-0.5.2-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file xontrib-output-search-0.5.2.tar.gz.

File metadata

  • Download URL: xontrib-output-search-0.5.2.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for xontrib-output-search-0.5.2.tar.gz
Algorithm Hash digest
SHA256 324cb70c3680ee08f0388a0452eff01d8c6d5beb6694ea9703725cf1bb4dc67c
MD5 e0c9a941d9c30a74896ff4ae720bcfd7
BLAKE2b-256 86ff0daf30206d81e7744d043175017f3d8ca8a39f07c36dad12338048b336e5

See more details on using hashes here.

File details

Details for the file xontrib_output_search-0.5.2-py3-none-any.whl.

File metadata

  • Download URL: xontrib_output_search-0.5.2-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for xontrib_output_search-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 56d074fbd34e1dc9877576524a763af7c604cef63d3d14b57e73c101f61be6cb
MD5 b36c9da6959119d87cf1d06aa1235056
BLAKE2b-256 97049b74e1bc33959f4cb4ffcf4bb3d49e9f736ce352a85b239d5b28ecc46024

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page