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

[request] more examples in the README #3

Open
salahoued opened this issue Oct 1, 2024 · 4 comments
Open

[request] more examples in the README #3

salahoued opened this issue Oct 1, 2024 · 4 comments

Comments

@salahoued
Copy link

I've come across this project by pure chance, after looking into the pywayland project,
I was looking for a rusty fzf to replace the now dormant skim, it was happy surprise for me.

I can see that sweep offers good functionalities the like of which fzf has, but I couldn't get some to work for me,
like the --preview option, I couldn't find the proper way for it to work. Is it like fzf: --preview 'bat {}' or is there any other way.

I tried to run the demo python -msweep demo, it didn't work

Traceback (most recent call last):
  File "<frozen runpy>", line 189, in _run_module_as_main
  File "<frozen runpy>", line 159, in _get_module_details
  File "<frozen importlib._bootstrap_external>", line 1074, in get_code
  File "<frozen importlib._bootstrap_external>", line 1004, in source_to_code
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/salo/Documents/sweep-rs/sweep/sweep/sweep.py", line 126
    class SweepSelect[I]:
                     ^
SyntaxError: invalid syntax

From this output I couldn't figure out the problem, is it some dependency missing?

I use opensuse Tumblweed and python-3.11

Thank for all your hard work, you've put into this utility

@aslpavel
Copy link
Owner

  • It used to be that --preview did a different thing, but I have decided to change it to be more inline with the fzf, so now you can run ls | sweep --preview 'cat {}' it should work as expected. For now only colored output is supported, I will add more functionality in the future
  • with regards to syntax error, sweep.py assumes python3.12 and higher.

@salahoued
Copy link
Author

Thanks again for your hard work;
Yes, it works just fine.

For a fun story, I pulled the latest git version, compiled with cargo and run the example ls | sweep --preview 'cat {}', and got : Error parsing option '--preview' with value 'cat {}': provided string was not true or false.
wandering why it didn't work was about to report it, until I remembered that I did run it with old version. :)

Last, I couldn't start the demo again with python3.12 -msweep demo, I got:

usage: sweep.py [-h] [-p PROMPT] [--prompt-icon PROMPT_ICON] [--query QUERY] [--nth NTH] [--delimiter DELIMITER] [--theme THEME] [--scorer SCORER] [--tty TTY] [--height HEIGHT]
                [--sweep SWEEP] [--json] [--no-match {nothing,input}] [--keep-order] [--input INPUT] [--tmp-socket] [--log LOG] [--border BORDER]
sweep.py: error: unrecognized arguments: demo

And I tried ls | python3.12 -msweep and did run correctly.

Thanks again.

@aslpavel
Copy link
Owner

To run the demo you need to run it from sweep-py directory

@salahoued
Copy link
Author

Sorry about that,

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

No branches or pull requests

2 participants