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

Add engine environment flags 'HORS_ENGINE' #65

Merged
merged 2 commits into from
Aug 7, 2020
Merged

Add engine environment flags 'HORS_ENGINE' #65

merged 2 commits into from
Aug 7, 2020

Conversation

dzervas
Copy link
Contributor

@dzervas dzervas commented Aug 7, 2020

The only consistent change that I'd think of doing to the program (configuration-wise) is the default engine - to avoid passing -e every time, so I added env var support with the HORS_ENGINE variable.

Example (I found a query that was different for duckduckgo vs google):

dzervas hors> ./target/debug/hors -e google rust vec string join chinese version wow
- Answer from https://stackoverflow.com/questions/7488206
SELECT id, CONCAT(firstName, ' ', lastName) AS fullName FROM table

dzervas hors> ./target/debug/hors -e duckduckgo rust vec string join chinese version wow
Search for target link failed: Parse("Can\'t find search result...")

dzervas hors> HORS_ENGINE=google ./target/debug/hors rust vec string join chinese version wow
- Answer from https://stackoverflow.com/questions/7488206
SELECT id, CONCAT(firstName, ' ', lastName) AS fullName FROM table

@dzervas
Copy link
Contributor Author

dzervas commented Aug 7, 2020

(BTW duckduckgo is for some reason inconsistent, sometimes the test_search_links_with_duckduckgo_search_engine test fails with panicked at 'called `Result::unwrap()` on an `Err` value: Parse("Can\'t find search result...")', tests/test_engine.rs:57:6 for an unknown to me reason)

@WindSoilder
Copy link
Owner

Hi, thanks for your contribution :-D It's excellent work!

The origin howdoi program also have something like HOWDOI_SEARCH_ENGINE environment variable. And we can also have this :) Thanks for your idea

@WindSoilder WindSoilder merged commit ec95749 into WindSoilder:master Aug 7, 2020
@WindSoilder
Copy link
Owner

(BTW duckduckgo is for some reason inconsistent, sometimes the test_search_links_with_duckduckgo_search_engine test fails with panicked at 'called `Result::unwrap()` on an `Err` value: Parse("Can\'t find search result...")', tests/test_engine.rs:57:6 for an unknown to me reason)

Oh yeah, for this problem, I have submit a new issue.

@dzervas
Copy link
Contributor Author

dzervas commented Aug 7, 2020

maybe we should change it to HORS_SEARCH_ENGINE to be a bit more friendly to old howdoi users?

@WindSoilder
Copy link
Owner

Hmm, I'm ok with both option. Because HORS_ENGINE seems more simpler

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