Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom command #258

Closed
wants to merge 2 commits into from
Closed

Custom command #258

wants to merge 2 commits into from

Conversation

kevincox
Copy link

This adds support for user provided scanners.

Note: This is based off of #253.

@wincent
Copy link
Owner

wincent commented Jan 2, 2017

Thanks for this, @kevincox. Right now I am traveling without a laptop (writing this from my phone), but this looks pretty useful. Well look at merging when I get back.

@kevincox
Copy link
Author

kevincox commented Jan 2, 2017

No rush @wincent, I'm fine running it on my own machine and it would be awesome to get some feedback from anyone else who finds this useful.

This scanner allows low overhead reading of files. It can currently read
paths from an array of strings (good for ruby-based scanners) and a
terminated string (great for command executor scanners).

This also converts the find scanner and the git scanner to use the
string based infrastructure.
This option provides the user with ultimate flexibility. They have the
choice to provide any shell command, script or pipeline in order to
generate a file list.

To give the command more context in the future variables can be set before
calling the user command in the shell to pass more information to the external
command. This allows future backwards compatible extension.

The only drawback I see is that the terminator is "static" for example if
a user has a script that switches the technique used based on context
(for example current path) it will always have to use the same
terminator. Luckily the workaround is simple by using `| tr '\n' '\0'`
to convert newlines (or whatever the alternative separator is) to nulls
and setting CommandT to always use nulls. This has a slight CPU and
memory overhead but since it runs in parallel it should be insignificant
on a multi-core machine.
wincent added a commit that referenced this pull request Jul 17, 2022
This is the spiritual successor to:

    #258

As a demo, I've shown how to plug `rg` into it. Currently ignored: the
`dir` parameter.

Closes: #258
@wincent
Copy link
Owner

wincent commented Jul 17, 2022

Closing this as it will have a replacement in the Lua rewrite.

@wincent wincent closed this Jul 17, 2022
Padmamanickam added a commit to Padmamanickam/command-t that referenced this pull request Feb 6, 2023
This is the spiritual successor to:

    wincent/command-t#258

As a demo, I've shown how to plug `rg` into it. Currently ignored: the
`dir` parameter.

Closes: wincent/command-t#258
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants