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 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 combination before loading the xontrib:
# Alt+i combination
$XONTRIB_OUTPUT_SEARCH_KEY='i'
xontrib load output_search
# Control+g combination
$XONTRIB_OUTPUT_SEARCH_KEY_BINDING='c-g'
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 (xonsh/issues/3744)
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
.
Links
- This package is the part of ergopack - the pack of ergonomic xontribs.
- This package was created with xontrib cookiecutter template.
- I was inspired by xontrib-histcpy. Thanks @con-f-use!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file xontrib-output-search-0.5.4.tar.gz
.
File metadata
- Download URL: xontrib-output-search-0.5.4.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ea95281677ecab6f6f4c8f928348543c0dcc65544ff568c591498e7392b25c2 |
|
MD5 | caccdee7a34bd84fc88a579683007232 |
|
BLAKE2b-256 | fb5ac7e221e0910cdcc0460fb451fe33895fdc557dbc214fa8a4d260eacb7fb8 |
File details
Details for the file xontrib_output_search-0.5.4-py3-none-any.whl
.
File metadata
- Download URL: xontrib_output_search-0.5.4-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 83dc1979532a3bb2f91ee560a212aba24ebdc87b2ee3d753dabbb44aac4aa973 |
|
MD5 | 52053fe61a7696c764b46b70ad06631b |
|
BLAKE2b-256 | 47af76a116364041f2c7560ae9b2ca193a39e028cb19188287ff0bea7928d175 |