ttscoff / searchlink

MIT License
59 stars 5 forks source link

FR: Do make `searchlink` CLI available #6

Closed chrisgrieser closed 11 months ago

chrisgrieser commented 1 year ago

In your latest blogpost, you mention that by building searchlink yourself, a searchlink cli becomes available. I'd actually think that would be a great addition to make searchlink more versatile in use.

One example could be integration in third-party apps. Right now, I am using this cumbersome snippet to trigger searchlink programmatically, (e.g. via Alfred):

echo -n $(automator -r -i "$*" ~/Library/Services/SearchLink.workflow | sed -n 2p | cut -d\" -f2)
ttscoff commented 11 months ago

You can just clone this repo, run bundle install and then bundle exec rake package to get a gem with a binary. Then just gem install pkg/searchlink-x.x.x.gem to add the binary to your path. I may actually push it to RubyGems eventually, but I don't see it being broadly applied in a way that makes sense to publish it to the repository...

ttscoff commented 11 months ago

Ok, I buckled and pushed SearchLink to the RubyGems repository. You can now just run gem install searchlink to get the latest version as a CLI.

ttscoff commented 11 months ago

Note that because it was designed to work with Automator input, you have to run echo 'SEARCH' | searchlink unless you're running it on a file, in which case you would use searchlink FILE.md. You can always create a shell alias to run:

search() {
    echo $* | searchlink
}