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

Added option "--exec CMD" #158

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

michael105
Copy link

For a documentation browser (https://github.com/michael105/libc-manpages)
I added the option to execute commands from within fzy.
imho, would be great to include that mainline.
best wishes,Michael

src/options.c Outdated
@@ -20,6 +20,7 @@ static const char *usage_str =
" -0, --read-null Read input delimited by ASCII NUL characters\n"
" -j, --workers NUM Use NUM workers for searching. (default is # of CPUs)\n"
" -i, --show-info Show selection info line\n"
" -x, --exec=PROG Execute prog on selection. Don't exit.\n"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indentation is different here, than in the surrounding lines

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, ;) I literally didn't see it. Fixed it, and trying to push it again.

@neuschaefer
Copy link
Contributor

Hi, thanks for your PR.

This feature seems relatively unnecessary to me, since I think it could easily be implemented in a wrapper script.

@michael105
Copy link
Author

Hi, thanks for your PR.

This feature seems relatively unnecessary to me, since I think it could easily be implemented in a wrapper script.

That would do something different; what I added doesn't exit fzy, instead it spawns the command, waits for the program to exit and returns to exactly the same state before launching the external tool.
It's quite handy for e.g. the manual browser I did put online.
Look for a manpage, launch man, go back and compare e.g. the posix manual page with the freebsd's one.
There might be other usecases, like a directory browser, andsoon..
Thanks for this wonderful tool btw.
Best wishes, Michael

@neuschaefer
Copy link
Contributor

Ah thanks, I understand now

@michael105
Copy link
Author

:-? just for the record, the 'acceptance check' has necessarily to fail,
since the output of the help screen is compared between old and patched version.
There I added the explanation of the option --exec, so, this cannot work out..

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