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

Use Command Output as Action Parameter #225

Open
frapit opened this issue Dec 22, 2023 · 1 comment
Open

Use Command Output as Action Parameter #225

frapit opened this issue Dec 22, 2023 · 1 comment
Labels
help wanted An issue in need of someone to implement a change

Comments

@frapit
Copy link

frapit commented Dec 22, 2023

Is there a mechanism to use the output of a bash command as input for a subsequent action?

For instance, I would want to bind a key to do some small bash calculation based on the current image name and then jump n images forward, where n is the output of the bash calculation, e.g. something like:

pqiv --bind-key 'f { command(echo $1 && n=5); goto_file_relative($n)) }' .

@phillipberndt phillipberndt added the help wanted An issue in need of someone to implement a change label Jan 2, 2024
@phillipberndt
Copy link
Owner

Implementation is quite straightforward, see read_commands_thread for how to schedule a bunch of commands, and apply_external_image_filter for how commands are run. We'd have to add a new prefix, e.g. "@", and make that behave like a combination of the pipe (|) and plain command: Pass the filename as a parameter, connect a pipe to stdout of the process, read it from another thread and process it as actions.

I'd for simplicity not allow to define variables like that, just require that the script outputs the full commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted An issue in need of someone to implement a change
Projects
None yet
Development

No branches or pull requests

2 participants